https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87239
janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code Status|UNCONFIRMED |NEW Last reconfirmed| |2018-09-06 Ever confirmed|0 |1 --- Comment #3 from janus at gcc dot gnu.org --- I can confirm the ICE with all gfortran versions I tried (5 to trunk). Slightly reduced test case (a separate module is not necessary): program main implicit none character(3), parameter :: inp( 2 ) = [ 'aaa', 'bbb' ] character(:), allocatable :: out(:) out = gettwo( inp ) print *, out contains elemental function gettwo( s ) result( res ) character(*), intent(in) :: s character(2) :: res res = s(1:2) end function end