https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94109
--- Comment #11 from Antony Lewis <antony at cosmologist dot info> ---
It took ages to narrow this down, but here's a simple test case that still
gives a leak with valgrind in gcc-8 HEAD, 8.4.0, 9.3.0 (OK with 7.4.0)
module debug
implicit none
Type Tester
real, dimension(:), allocatable :: Dat, Dat2
end Type
Type TestType2
Type(Tester) :: T
end type TestType2
contains
subroutine Leaker
class(TestType2), pointer :: ActiveState
Type(Tester) :: Temp
allocate(Temp%Dat2(10000))
allocate(TestType2::ActiveState)
ActiveState%T = Temp
deallocate(ActiveState)
end subroutine
end module
program run
use debug
call Leaker()
end program