AArch64: correct constraint on Upl early clobber alternatives
[official-gcc.git] / gcc / testsuite / gfortran.dg / finalize_35.f90
blob66435c43ecc36839f8a1e086da1fa712963cbd1a
1 ! { dg-do compile }
2 ! { dg-additional-options "-fdump-tree-original" }
3 ! PR 94361 - this left open some memory leaks. Original test case by
4 ! Antony Lewis.
6 module debug
7 private
9 Type TypeWithFinal
10 contains
11 FINAL :: finalizer !No leak if this line is commented
12 end type TypeWithFinal
14 Type Tester
15 real, dimension(:), allocatable :: Dat
16 Type(TypeWithFinal) :: X
17 end Type Tester
19 Type :: TestType2
20 Type(Tester) :: T
21 end type TestType2
22 public Leaker
23 contains
25 subroutine Leaker
26 type(TestType2) :: Test
28 allocate(Test%T%Dat(1000))
29 end subroutine Leaker
31 subroutine finalizer(this)
32 Type(TypeWithFinal) :: this
33 end subroutine finalizer
35 end module debug
38 program run
39 use debug
40 implicit none
41 integer i
43 do i=1, 1000
44 call Leaker()
45 end do
47 end program run
48 ! { dg-final { scan-tree-dump-times "__builtin_free\\ \\(ptr2" 2 "original" } }