------- Comment #6 from burnus at gcc dot gnu dot org 2007-05-22 17:58 ------- > Created an attachment (id=13364) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13364&action=view) [edit]
This is only standard conform after changing dfloat() to real(..., kind(0d0)) and after changing call getrelval('sib', 'mea', 'test', 4, 1, MISS, work, 0) into call getrelval('sib', 'mea', 'test ', 4, 1, MISS, work, 0) With these changes it is Fortran 2003 standard conform and also compiles with NAG f95 > If line 251 is commented out and line 256 uncommented, only g95 compiles it > successfully. > Since dataset, nobs and relid are all subroutine arguments, it seems > plausible to me that the order of declaration should be irrelevant, even > though it require more work by the compiler. I haven't looked at the Fortran > Standard (and probably couldn't work out what it was saying anyway ;)) to see > if there is a defined behaviour. integer, dimension(dataset%maxsiz) :: nobs integer, dimension(dataset%maxsiz, MAXREC) :: relid type (ped_data) :: dataset I think gfortran rightly rejects the file though the error message should be improved. NAG f95 writes: Error: z.f90, line 253: Implicit type for DATASET detected at [EMAIL PROTECTED] Error: z.f90, line 253: DATASET is not of derived type detected at [EMAIL PROTECTED] Error: z.f90, line 256: Symbol DATASET has already been implicitly typed detected at ::@DATASET ifort is also better: fortcom: Error: z.f90, line 253: The structure-name is invalid or is missing. integer, dimension(dataset%maxsiz) :: nobs gfortran: Error: Expected another dimension in array declaration at (1) and later: Error: Symbol 'nobs' at (1) has no IMPLICIT type If I'm not mistaken, the relevant part of the standard is: "A variable within a specification expression shall have its type and type parameters, if any, specified by a previous declaration in the same scoping unit, by the implicit typing rules in effect for the scoping unit, or by host or use association. If a variable in a specification expression is typed by the implicit typing rules, its appearance in any subsequent type declaration statement shall confirm the implied type and type parameters." -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu dot | |org Keywords| |diagnostic Last reconfirmed|0000-00-00 00:00:00 |2007-05-22 17:58:49 date| | Summary|Array size declaration |improve error message for |depended on order of |using specification expr. of |declaration of variable |later decl. |containing size | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31560