2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_allocate_16.f90
blob57fcc4474496493f82acc437f0696fd482886681
1 ! { dg-do compile }
2 ! { dg-options "-fdump-tree-original" }
4 ! PR 59589: [4.9 Regression] [OOP] Memory leak when deallocating polymorphic
6 ! Contributed by Rich Townsend <townsend@astro.wisc.edu>
8 implicit none
10 type :: foo
11 real, allocatable :: x(:)
12 end type
14 type :: bar
15 type(foo) :: f
16 end type
18 class(bar), allocatable :: b
20 allocate(bar::b)
21 allocate(b%f%x(1000000))
22 b%f%x = 1.
23 deallocate(b)
25 end
27 ! { dg-final { scan-tree-dump-times "__builtin_free" 4 "original" } }