https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99585
Bug ID: 99585 Summary: ICE with SIZE intrinsic on nested derived type components Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: anlauf at gcc dot gnu.org Target Milestone: --- As reported by Tobias Burnus in https://gcc.gnu.org/pipermail/fortran/2021-March/055815.html the following code ICEs with all gcc since at least 7: module m type t class(*), pointer :: bar(:) end type type t2 class(t), allocatable :: my(:) end type t2 contains function f (x, y) result(z) class(t) :: x(:) class(t) :: y(size(x(1)%bar)) type(t) :: z(size(x(1)%bar)) end function g (x) result(z) class(t) :: x(:) type(t) :: z(size(x(1)%bar)) end subroutine s () class(t2), allocatable :: a(:), b(:), c(:), d(:) class(t2), pointer :: p(:) c(1)%my = f (a(1)%my, b(1)%my) d(1)%my = g (p(1)%my) end end