https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82814
Bug ID: 82814 Summary: ICE from submodule character function Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: werner.blokbuster at gmail dot com Target Milestone: --- The following program gives an ICE with gfortran 7.2.0 and 6.4.0. Unfortunately I do not have version 8 to test. module u implicit none interface unique module function uniq_char(input) result(uniq) character(*), intent(in) :: input(:) character(size(input)), allocatable :: uniq(:) end function uniq_char end interface unique end module u submodule (u) z implicit none contains module function uniq_char(input) result(uniq) character(*), intent(in) :: input(:) character(size(input)), allocatable :: uniq(:) allocate(uniq(1)) uniq = 'A' end function uniq_char end submodule z program test_uniq use u, only: unique implicit none write(*,*) unique(['1','2','1','2']) end program test_uniq ICE: test_uniq.f:27:0: allocate(uniq(1)) internal compiler error: Segmentation fault: 11 test_uniq.f:27:0: internal compiler error: Abort trap: 6 The program compiles and runs if any of: - character variables are replaced with integer or real variables; - the submodule is not used and the function is placed within module u; - the variable 'uniq' is given a fixed length, e.g. character(1). I'm running on a macbook 10.12.6 using gfortran from macports. WB