https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118747
--- Comment #2 from anlauf at gcc dot gnu.org ---
Maybe there are multiple issues here conspiring.
Without elemental procedure, without array constructor:
program p
implicit none
type string_t
! character(len=:), allocatable :: string_ ! "works"
character(len=3), allocatable :: string_ ! fails
end type
type(string_t) :: s
s = foo()
contains
type(string_t) function foo()
allocate (character(len=3) :: foo%string_)
foo%string_ = "foo"
end function
end
The failing (as indicated) version has been failing "forever" with gfortran.