Debian Codegraph @

gcc/testsuite/gfortran.dg/finalize_36.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-fdump-tree-original" }
3 ! PR 94109
4 ! This used to leak memory. Test case by Antony Lewis.
5 module debug
6 implicit none
7
8 Type Tester
9 real, dimension(:), allocatable :: Dat, Dat2
10 end Type
11
12 Type TestType2
13 Type(Tester) :: T
14 end type TestType2
15
16 contains
17
18 subroutine Leaker
19 class(TestType2), pointer :: ActiveState
20 Type(Tester) :: Temp
21
22 allocate(Temp%Dat2(10000))
23
24 allocate(TestType2::ActiveState)
25 ActiveState%T = Temp
26 deallocate(ActiveState)
27
28 end subroutine
29
30 end module
31
32
33 program run
34 use debug
35
36 call Leaker()
37
38 end program
39 ! { dg-final { scan-tree-dump-times "__builtin_free\\ \\(ptr2" 4 "original" } }