https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102885
Bug ID: 102885 Summary: [12 Regression] ICE when compiling gfortran.dg/bind_c_char_10.f90 with -flto Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dominiq at lps dot ens.fr CC: burnus at gcc dot gnu.org, hubicka at gcc dot gnu.org, iains at gcc dot gnu.org, sandra at gcc dot gnu.org Target Milestone: --- The test gfortran.dg/bind_c_char_10.f90 ICE when compiled with -flto: lto1: internal compiler error: Segmentation fault: 11 Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. lto-wrapper: fatal error: gfc returned 1 exit status compilation terminated. collect2: fatal error: lto-wrapper returned 1 exit status compilation terminated. Reduced test: module m use iso_c_binding, only: c_char implicit none (type, external) contains ! Assumed-shape array, nonallocatable/nonpointer subroutine ar3 (xn, n) bind(C) integer :: n character(len=n) :: xn(..) if (size(xn) /= 6) stop if (len(xn) /= 5) stop select rank(xn) rank(1) xn = ['FDGhf', & 'hdrhg', & 'fDgFl', & 'DFHs3', & '4a54G', & 'hSs6k'] rank default stop end select end end program main use m implicit none (type, external) character(kind=c_char, len=5) :: str5a6(6) ! assumed rank - with array descriptor str5a6 = ['DDGhf', & 'hdrh$', & 'fDGSl', & 'DFHs3', & '43grG', & 'hFG$k'] call ar3 (str5a6, 5) end All the other tests compile with -flto.