https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82996
--- Comment #1 from neil.n.carlson at gmail dot com --- In the second example, I add a final procedure for BAR (not necessary) and explicitly call the FOO final procedure on its B component. This gives an ICE f951: internal compiler error: in generate_finalization_wrapper, at fortran/class.c:1975 module mod type foo integer, pointer :: f(:) => null() contains final :: foo_destroy end type type bar type(foo) :: b(2) contains final :: bar_destroy end type contains elemental subroutine foo_destroy(this) type(foo), intent(inout) :: this if (associated(this%f)) deallocate(this%f) end subroutine subroutine bar_destroy(this) type(bar), intent(inout) :: this call foo_destroy(this%b) end subroutine end module program main use mod type(bar) :: x call sub(x) contains subroutine sub(x) type(bar), intent(out) :: x end subroutine end program