https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82934
kargl at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code | Status|RESOLVED |REOPENED CC| |kargl at gcc dot gnu.org Depends on| |83318 Resolution|FIXED |--- --- Comment #7 from kargl at gcc dot gnu.org --- I believe that this code is invalid Fortran. Fortran 2008 states An asterisk as a type-param-value specifies that a length type parameter is an assumed type parameter. It is used for a dummy argument to assume the type parameter value from the effective argument, for an associate name in a SELECT TYPE construct to assume the type parameter value from the corresponding selector, and for a named constant of type character to assume the character length from the constant-expr . In this code, subroutine alloc( bar ) character(len=*), allocatable :: bar bar is the dummy argument, so a type-spec with * can appear here. allocate( character(len=*) :: bar ) However, the type-spec in the allocate statement does coincide with the declaration of a dummy argument, or appear in SELECT TYPE, or in the declaration of a named constant. The * cannot appear here. end subroutine The correct subroutine is simply subroutine alloc( bar ) character(len=*), allocatable :: bar allocate( bar ) end subroutine It's not clear to me if Paul's patch needs to be removed as it appears to set a possibly dangling pointer to NULL Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83318 [Bug 83318] Illegal program causes internal compiler error with tags gfc_trans_allocate, at fortran/trans-stmt.c:5646 and Aborted (program f951)