module test_pgi_allocation_mod implicit none type array_wrapper integer, allocatable :: wrapper_array(:) end type array_wrapper type super_wrapper type(array_wrapper) :: meta_array end type super_wrapper contains subroutine destroy_array_wrapper(aa) type(array_wrapper), intent(out) :: aa end subroutine destroy_array_wrapper subroutine destroy_super(sw) type(super_wrapper), intent(out) :: sw end subroutine destroy_super end module test_pgi_allocation_mod program alloc_test_driver use test_pgi_allocation_mod implicit none type(super_wrapper) :: sw allocate(sw%meta_array%wrapper_array(2)) ! Frees all memory due to intent(out). ! call destroy_array_wrapper(sw%meta_array) ! Does not seem to recurse downward to free subobject memory. call destroy_super(sw) end program alloc_test_driver