https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97757
--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Reduced test: subroutine bar_array() logical, save :: first = .true. character(len=:), allocatable :: str if (first) then first = .false. if (allocated (str)) STOP 7 str = "ABCDEF" end if end subroutine bar_array call bar_array() end % gfc save_5_red.f90 -fno-automatic -flto -O2 during IPA pass: modref save_5_red.f90:12:3: internal compiler error: Segmentation fault: 11 12 | end | ^ >From the manual -fno-automatic Treat each program unit (except those marked as RECURSIVE) as if the SAVE statement were specified for every local variable and array referenced in it. Does not affect common blocks. (Some Fortran compilers provide this option under the name -static or -save.) The default, which is -fautomatic, uses the stack for local variables smaller than the value given by -fmax-stack-var-size. Use the option -frecursive to use no static memory. Local variables or arrays having an explicit SAVE attribute are silently ignored unless the -pedantic option is added.