aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/class_allocate_16.f90
blob: 28776084d8661444c78c542c4f4752123c1f28a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
! { dg-do compile }
! { dg-options "-fdump-tree-original" }
!
! PR 59589: [4.9 Regression] [OOP] Memory leak when deallocating polymorphic
!
! Contributed by Rich Townsend <townsend@astro.wisc.edu>

  implicit none

  type :: foo
     real, allocatable :: x(:)
  end type

  type :: bar
     type(foo) :: f
  end type

  class(bar), allocatable :: b

  allocate(bar::b)
  allocate(b%f%x(1000000))
  b%f%x = 1.
  deallocate(b)

end

! { dg-final { scan-tree-dump-times "__builtin_free" 4 "original" } }
! { dg-final { cleanup-tree-dump "original" } }