http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49331
Summary: Accepts invalid specification expressions Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org gfortran currently compiles http://www.fortran.com/iso_varying_string.f95 with -std=f2003 without any error. Expected: gfortran rejects the program with an error messages. Crayftn correctly rejects the program with: character(LEN=len(string)) :: char_string ^ ftn-355 crayftn: ERROR CHAR_AUTO, File = iso_varying_string.f90, Line = 861, Column = 19 Generic interface "LEN" is referenced in a declarative expression in a [sub]module. Specific "LEN_" must be completely specified prior to being referenced. The function being use is the innocently looking: pure function char_auto (string) result (char_string) type(varying_string), intent(in) :: string character(LEN=len(string)) :: char_string However, the specific function to which then LEN() resolves is not the intrinsic LEN, but the specific function LEN_, which is defined in the same module - but (crucially!) later than the function char_auto, which uses it. That's invalid! For a shorter example, see interpretation request J3/11-101, F08/0050, which passed already J3 and will be voted on soon by WG5. Cf. http://j3-fortran.org/doc/year/11/11-101r1.txt (Note: If the file is edited, the revision number is incremented, please remember to check whether there is, e.g., a 11-101r2.txt.)