http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47915
Summary: Type declaration: Recursive specification expression not detected. Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org Based on http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/8c8effead3390ad2 The following is invalid as the LEN= specification expression is circular and -- with the "+1" in LEN not possible. (I think without "+1" it might work as the implicit typing has len=1, which is then used to type "a" which can then used for "b" and which then matches the initial value of 1. It is probably still invalid, but at least not contradictory.) >From the standard: "A variable in 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." (F2008, 7.1.11 Specification expression) Test case - only g95 complains: Error: Circular specification in variable 'a' at (1) gfortran accepts it even with -std=f95 subroutine foo(a, b) implicit character (A-Z) character(len=len(b)+1) :: a character(len=len(a)+1) :: b end