[Bug fortran/77602] ICE with cyclic length declaration: Killed (program f951)
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 15 18:11:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77602
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
"cyclic" is the wrong word.
subroutine s(x) ! line 1
implicit character (a-z) ! line 2
character(len=len(y)+1) :: x ! line 3
character(len=len(x)+1) :: y ! line 4
end ! line 5
line 2 causes the first reference to 'y' to
give 'y' an implicit type of CHARACTER(1), so
'x' in line 3 has len=2. 'y' may appear in
a subsequent declaration where that declaration
confirms the type. Hmmm, this took awhile to
find (F2003, p126):
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.
This is not a numbered constraint. The requirement is on the
programmer to get it right. So, yes, the code is invalid, and
gfortran can do anything it wants including ICE.
More information about the Gcc-bugs
mailing list