https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78641
--- Comment #3 from janus at gcc dot gnu.org --- Here is a slightly simpler version, replacing the function call with a variable reference, which fails with the same ICE with version 5, 6 and trunk: implicit none type foo end type type(foo) :: bar(1) class(foo), allocatable :: x allocate(x, source=foo()) bar = [x] end Version 4.9 again compiles fine, but I suspect that it generates wrong code.