https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100656
--- Comment #2 from anlauf at gcc dot gnu.org --- Using a temporary may help: subroutine s(x) character(:), allocatable, optional :: x(:) character(:), allocatable :: y(:) if ( present(x) ) then if ( allocated(x) ) then y = 'a' // x // 'e' x = y end if end if end This does not ICE.