Patchwork [wwwdata] Update Fortran section of gcc-4.6/changes.html

login
register
mail settings
Submitter Tobias Burnus
Date Aug. 19, 2010, 8:03 a.m.
Message ID <4C6CE567.2080200@net-b.de>
Download mbox | patch
Permalink /patch/62115/
State New
Headers show

Comments

Tobias Burnus - Aug. 19, 2010, 8:03 a.m.
I have already committed the attached patch, but don't hesitate to 
suggest changes or other improvements.

Cf. http://gcc.gnu.org/gcc-4.6/changes.html#Fortran

Tobias
Daniel Kraft - Aug. 19, 2010, 8:26 a.m.
Tobias Burnus wrote:
>  I have already committed the attached patch, but don't hesitate to 
> suggest changes or other improvements.

Looks good, but reminds me that implied-shape arrays are still missing 
from that list.

Yours,
Daniel
Gerald Pfeifer - Dec. 15, 2010, 10:26 p.m.
On Thu, 19 Aug 2010, Tobias Burnus wrote:
> I have already committed the attached patch, but don't hesitate to suggest
> changes or other improvements.
> 
> Cf. http://gcc.gnu.org/gcc-4.6/changes.html#Fortran

The following snippet sounds a bit confusing to me, though admittedly
I am not a Fortran hacker:

+       <li>Null pointers (including <code>NULL()</code>) and not
+       allocated variables can be used as actual argument to optional
+       non-pointer, non-allocatable dummy arguments, denoting an absent
+       argument.</li>

Is "actual argument" a standard term?  "as actual argument to ...
arguments, denoting an absent argument" sounds a bit tricky.

(Something may not be right with singular and plural here, too:
first is singular, the second one plural, the third one singular
again.)

+       <li>Non-pointer variables with <code>TARGET</code> attribute can

"with the <code>TARGET</code> attribute"?

Gerald
Steve Kargl - Dec. 15, 2010, 10:38 p.m.
On Thu, Dec 16, 2010 at 06:26:31AM +0800, Gerald Pfeifer wrote:
> On Thu, 19 Aug 2010, Tobias Burnus wrote:
> > I have already committed the attached patch, but don't hesitate to suggest
> > changes or other improvements.
> > 
> > Cf. http://gcc.gnu.org/gcc-4.6/changes.html#Fortran
> 
> The following snippet sounds a bit confusing to me, though admittedly
> I am not a Fortran hacker:
> 
> +       <li>Null pointers (including <code>NULL()</code>) and not
> +       allocated variables can be used as actual argument to optional
> +       non-pointer, non-allocatable dummy arguments, denoting an absent
> +       argument.</li>
> 
> Is "actual argument" a standard term?  "as actual argument to ...
> arguments, denoting an absent argument" sounds a bit tricky.

Yes, "actual argument" is a standard term. 

program test
   integer i
   call foo(i)    ! i is the actual argument.
end program test
subroutine foo(j) ! j is the dummy argument.
   integer j
   print *, j
end subroutine foo

In the standard, one finds passages of like "'i' is the
actual argument associated with the dummy argument 'j'".

I'll suggest a rewording of the form

    <li>Null pointers and unallocated allocatable variables can be used
        as actual arguments to optional non-pointer, non-allocatable
        dummy arguments to denote an absent argument.</li>
Daniel Franke - Dec. 15, 2010, 10:54 p.m.
On Wednesday 15 December 2010 23:38:53 Steve Kargl wrote:
> I'll suggest a rewording of the form
> 
>     <li>Null pointers and unallocated allocatable variables can be used
>         as actual arguments to optional non-pointer, non-allocatable
>         dummy arguments to denote an absent argument.</li>

Hi all,

since I missed the commit and this is news to me - maybe one could add a word 
why this _is_ news and actually noteworthy?

IIRC, there was something that absent dummy arguments where marked by 0L, 
hence one could not pass a NULL pointer as it would be seen as "absent" not as 
"present with value 0". If that's the one, mentioning it might certainly help 
an unaware reader.

Just a thought.

	Daniel
Tobias Burnus - Dec. 16, 2010, 8:02 a.m.
Gerald Pfeifer wrote:
> +<li>Null pointers (including<code>NULL()</code>) and not
> +       allocated variables can be used as actual argument to optional
> +       non-pointer, non-allocatable dummy arguments, denoting an absent
> +       argument.</li>

> +<li>Non-pointer variables with<code>TARGET</code>  attribute can

Quote from the introduction of the Fortran 2008 standard (cf. 
http://gcc.gnu.org/wiki/GFortranStandards):

"Fortran 2008 contains several extensions to Fortran 2003; some of these 
are listed below." [...]
"Programs and procedures: [...] An actual argument with the TARGET
attribute can correspond to a dummy pointer. A null pointer or 
unallocated allocatable can be used to
denote an absent nonallocatable nonpointer optional argument."

Regarding the latter:
a) Cf. Steve's email about the word "dummy" vs. "actual argument".

b) Fortran allows to have optional arguments. Internally, gfortran (and 
most other Fortran compilers) passes a NULL pointer if the (actual) 
argument is absent. However, doing so as user is only allowed since 
Fortran 2008. (For arrays also a code change was required.)

Daniel Franke wrote:
> since I missed the commit and this is news to me - maybe one could add a word
> why this_is_  news and actually noteworthy?

Regarding the noteworthiness: It is listed in the Fortran 2008 standard 
as being a new feature - thus listing it helps users knowing the F2008 
list  (while others are made aware of this feature); additionally, I 
think it is a quite useful feature as one now can pass, e.g., a 
not-allocated variable as absent argument. Before it only worked for 
scalar variables, relying on a particular implementation - now it also 
works for arrays.

However, one could also move it into the "Minor changes" item at 
http://gcc.gnu.org/gcc-4.6/changes.html#Fortran


> IIRC, there was something that absent dummy arguments where marked by 0L,
> hence one could not pass a NULL pointer as it would be seen as "absent" not as
> "present with value 0". If that's the one, mentioning it might certainly help
> an unaware reader.

No, that's a separate, still unfixed issue which only occurs if one 
mixes (pass by) VALUE with OPTIONAL arguments. (And a Fortran 2003 item 
as VALUE is allowed since 2003.)

(Side note: The upcoming technical report on further C interoperability 
will also allow C_NULL_PTR (C: "NULL") to denote an absent argument and, 
thus, allows "OPTIONAL" in BIND(C) procedure - but not together with VALUE.)

Tobias

Patch

Index: changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.6/changes.html,v
retrieving revision 1.34
diff -u -r1.34 changes.html
--- changes.html	28 Jul 2010 18:04:00 -0000	1.34
+++ changes.html	19 Aug 2010 07:50:34 -0000
@@ -180,6 +180,19 @@ 
 	<li>Support for <code>ALLOCATE</code> with <code>MOLD</code>.</li>
 	<li>Support for the <code>STORAGE_SIZE</code> intrinsic inquiry
 	function.</li>
+	<li>Support for the <code>IMPURE</code> attribute for procedures,
+	which allows for <code>ELEMENTAL</code> procedures without the
+	restrictions of <code>PURE</code>.</li>
+	<li>Null pointers (including <code>NULL()</code>) and not
+	allocated variables can be used as actual argument to optional
+	non-pointer, non-allocatable dummy arguments, denoting an absent
+	argument.</li>
+	<li>Non-pointer variables with <code>TARGET</code> attribute can
+	be used as actual argument to <code>POINTER</code> dummies with
+	<code>INTENT(IN)</code></li>
+	<li>Pointers including procedure pointers and those in a derived
+	type (pointer components) can now be initialized by a target
+	instead of only by <code>NULL</code>.</li>
 	<li>Minor changes: obsolesce diagnostics for <code>ENTRY</code>
 	was added for <code>-std=f2008</code>;
 	a line may start with a semicolon;
@@ -189,7 +202,8 @@ 
 	<code>RADIX</code> argument; intrinsic types are supported for
 	<code>TYPE(<i>intrinsic-type-spec</i>)</code>; multiple type-bound
 	procedures can be declared in a single <code>PROCEDURE</code>
-	statement.</li>
+	statement; assumed-shape arrays are supported for named constants.
+	</li>
       </ul>
     </li>
   </ul>