Derived type Destroy function does not take step into consideration
when indexing the component element for deallocation. This leads to
incorrect deallocation in case like:
module mod1 type :: t real, allocatable :: r(:) end type contains subroutine do_smth(c) class(t), intent(out) :: c(:) do i = 1, size(c) if (allocated(c(i)%r)) then print*, i, 'not deallocated' end if end do end subroutine end module program test use mod1 type(t) :: z(6) integer :: i do i = 1, 6 Allocate(z(i)%r(i)) end do call do_smth(z(::2)) end
Similar change was done in D142527
descriptor.GetLowerBounds(at); is the usage that's most common in the runtime, and might be faster.