[Bug fortran/35040] usage of init expression in its own definition
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Jan 31 12:46:00 GMT 2008
------- Comment #1 from burnus at gcc dot gnu dot org 2008-01-31 12:22 -------
I think this is valid. One has to read carefully what specification-part and
entity-decl means. I think after "integer(8)" the kind is known and in the next
specification part (e.g. for the dimension) one may use it; similar for your
example: After the bounds are known in the specification (i.e. before "::") one
may use it in the entry decl.
However, the following is circular and thus invalid:
REAL(8), PARAMETER :: xyz(size(xyz)) = 1
which is rejected by NAG f95:
Error: Shape enquiry on PARAMETER XYZ before its array declarator is complete
but gfortran wrongly accepts it.
I wonder whether the following is valid or not:
REAL(8), dimension(kind(xyz)) :: xyz
NAG f95 and gfortran say yes, ifort says no.
That dimension depends on the kind is ok, the problem is whether one may
already use "xyz" or not.
>From "7.1.7 Initialization expression" (F2003):
"If an initialization expression includes a specification inquiry that depends
on a type parameter or an array bound of an entity specified in the same
specification-part, the type parameter or array bound shall be specified in a
prior specification of the specification-part. The prior specification may be
to the left of the specification inquiry in the same statement, but shall not
be within the same entity-decl."
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35040
More information about the Gcc-bugs
mailing list