https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88511
--- Comment #1 from Stephen Soliday <stephen at soliday dot com> --- One of the respondents in Stack overflow posted this reduced version of my code that also reproduces the segmentation fault. program main implicit none character(:), allocatable :: txt call sub1(txt) print *, "main ", len(txt), txt ! prints: main 0 (or throws segfault) contains subroutine sub1(txt) character(:), allocatable, optional, intent(out) :: txt call sub2(txt) print *, "sub1 ", len(txt), txt ! prints: sub1 0 (or throws segfault) end subroutine sub1 subroutine sub2(txt) character(:), allocatable, optional, intent(out) :: txt if(present(txt)) txt = "message" print *, "sub2 ", len(txt), txt ! prints: sub2 7 message end subroutine sub2 end program main