The following is frequently used and accepted by many compilers; thus it should continue to work in -std=gnu, but - if feasible - one should reject it with -std=f95/f2003.
subroutine y data emname/'bar'/ character(len=3) :: emname end subroutine y Accepted by most compilers including the picky NAG f95. Rejected by g95: Symbol 'emname' at (1) being given type CHARACTER(1) already has implicit type REAL(4) "5.2.5 DATA statement [...] A variable that appears in a DATA statement and has not been typed previously may appear in a subsequent type declaration only if that declaration confirms the implicit typing. An array name, array section, or array element that appears in a DATA statement shall have had its array properties established by a previous specification statement." The part about DIMENSION is taken into account. * * * subroutine y(A,n) implicit none real :: A(n) integer :: n end subroutine y This is invalid as "n" is first used and then typed. NAG f95 rejects it with: Error: Implicit type for N Error: Symbol N has already been implicitly typed as other compilers accept this, it frequently occurs and should be allowed for -std=gnu. See: F2003, 7.1.6 (Specification expression), pg 126 F95, 7.1.6.2 (Specification expression), pg 96 "A variable in a specification expression shall have its type and type parameters, if any, specified by a previous declaration in the scoping unit, by the implicit typing rules in effect for the scoping unit, or by host 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 implicit type and type parameters". -- Summary: -std=f* should diagnose used but later typed variables Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: diagnostic Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34228