http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49110
--- Comment #9 from kargl at gcc dot gnu.org 2011-05-22 19:00:06 UTC ---
Note the routine need not be pure to invoke the segfault. Here's
an even shorter test case.
program foo
implicit none
character s(5)
s = ['a', 'b', 'c', 'd', 'e']
print *, bar(s)
contains
function bar(s) result(a)
! character, intent(in) :: s(5) ! Compiles and runs
character, intent(in) :: s(:) ! Compiles and segfaults
character(len=:), allocatable :: a
a = repeat('a', size(s))
end function bar
end program foo