[patch, fortran, committed] Document COMPLEX*k syntax quirk.

Tobias Burnus burnus@net-b.de
Fri Feb 23 01:10:00 GMT 2007


Hi,

you missed the diff, one can find it at:
http://gcc.gnu.org/viewcvs/trunk/gcc/fortran/gfortran.texi?r1=121201&r2=122238&pathrev=122238&diff_format=h
http://gcc.gnu.org/viewcvs/trunk/gcc/fortran/decl.c?r1=121830&r2=122238&pathrev=122238&diff_format=h

trunk/gcc/fortran/decl.c:
-/* Match an extended-f77 kind specification.  */
+/* Match an extended-f77 kind specification.  This assumes that the kind
+   number is equal to the byte size for non-COMPLEX types, and equal to 
+   half of the byte size for COMPLEX.  */

Well, the kind number matches the complete byte-size of the complex variable (Re+Im). I think something like:

+/* Match an extended-f77 kind specification.  This assumes that the kind
+   number is equal to the byte size; for COMPLEX it is the total byte size
+   of real plus imaginary part.  */


Similarily for gfortran.texi; instead of

 where @code{TYPESPEC} is a basic type (@code{INTEGER}, @code{REAL},
+etc.), and where @code{size} is a byte count corresponding to a valid
+kind for that type. The statement then declares @code{x}, @code{y} and
+@code{z} to be of type @code{TYPESPEC} with the appropriate kind. This
+is equivalent to the standard conforming declaration
 @smallexample
       TYPESPEC(k) x,y,z
 @end smallexample
+where @code{k} is equal to @code{size} for most types, but is equal to
+@code{size/2} for the @code{COMPLEX} type.

I would prefer something like:

 where @code{TYPESPEC} is a basic type (@code{INTEGER}, @code{REAL},
+etc.), and where @code{size} is a byte count corresponding to a valid
+kind for that type; for the @code{COMPLEX} type the @code{size} is
+byte count of real plus imaginary part.
+The statement then declares @code{x}, @code{y} and
+@code{z} to be of type @code{TYPESPEC} with the appropriate kind. This
+is equivalent to the standard conforming declaration
 @smallexample
       TYPESPEC(k) x,y,z
 @end smallexample
+where @code{k} is equal to @code{size} for most types, but is equal to
+@code{size/2} for the @code{COMPLEX} type.



Tobias



More information about the Gcc-patches mailing list