This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/27997] Fortran 2003: Support type-spec for array constructor



------- Comment #18 from burnus at gcc dot gnu dot org  2008-04-01 14:18 -------
> I see, thanks!  I thought it would be the longest length (i.e., clipped by the
> array definition assigned to).

For completeness: See "4.7 Construction of array values" in the Fortran 2003
standard (http://gcc.gnu.org/wiki/GFortranStandards). There one finds:

"C494 (R466) If type-spec is omitted, each ac-value expression in the
array-constructor shall have the same type and kind type parameters."

This does not apply yet as we have everywhere default-kind character variables.
But it continues a few lines later as follows (note the "same length type
parameter"):

"If type-spec is omitted, each ac-value expression in the array constructor
shall have the same length type parameters; in this case, the type and type
parameters of the array constructor are those of the ac-value expressions.

"If type-spec appears, it specifies the type and type parameters of the array
constructor. Each ac-value expression in the array-constructor shall be
compatible with intrinsic assignment to a variable of this type and type
parameters.[...]"


In general, it is quite helpful to look at the specification in the Fortran
standard, when one implements something. (Although it takes some time to get
somewhat used to the standard; still I find it quite readable.) A Fortran
textbook or Reid's F2003 intro
(ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1648.pdf) are helpful, but at the end
the standard is the only official and definite reference. If you need
interpretation help or help searching, write me an email (or try the IRC, link
see http://gcc.gnu.org/wiki/GFortran). It if gets too difficult, one ends up
asking at comp.lang.fortran or even requesting an official interpretation (cf.
PR 34805).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27997


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]