https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64986
--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Reduced test program test implicit none type t integer :: ii end type t type, extends(t) :: u real :: rr end type u type, extends(t) :: v real, allocatable :: rr(:) end type v type, extends(v) :: w real, allocatable :: rrr(:) end type w type(v) :: b(3) b = func7() ! scalar daughter type to array - alloc comps in parent type contains function func7() result(res) class(v), allocatable :: res allocate (res, source = w(3,[10.0,20.0],[100,200])) end function func7 end program test There is no problem with the original test once the following lines are commented b = func7() ! scalar daughter type to array - alloc comps in parent type if (any (b(2)%rr .ne. [10.0,20.0])) call abort