https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86328
--- Comment #8 from janus at gcc dot gnu.org --- Reducing the test case slightly more: program ptr_alloc type :: t class(*), allocatable :: val end type type :: list type(t), dimension(:), pointer :: ll end type integer :: i type(list) :: a allocate(a%ll(1:2)) do i = 1,2 allocate(a%ll(i)%val, source=i) end do call rrr(a) contains subroutine rrr(a) type(list), intent(in) :: a class(*), allocatable :: c allocate(c, source=a%ll(2)%val) end subroutine end The bad stuff obviously happens in the allocate statement inside 'rrr'. The dump for this version is a bit more compact, but still rather cryptic.