https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99585
--- Comment #2 from anlauf at gcc dot gnu.org --- Actually the SIZE intrinsic might be a red herring, as the following variant does also ICE: module m type t end type type t2 integer :: n end type t2 contains function h (x) result(z) class(t2) :: x(:) ! ICE ! type(t2) :: x(:) ! no ICE type(t) :: z(x(1)%n) end subroutine s type(t2), allocatable :: a(:) type(t), allocatable :: u(:) u = h (a) end end