1! { dg-do compile } 2! { dg-options "-fdump-tree-original" } 3! 4! PR 59589: [4.9 Regression] [OOP] Memory leak when deallocating polymorphic 5! 6! Contributed by Rich Townsend <townsend@astro.wisc.edu> 7 8 implicit none 9 10 type :: foo 11 real, allocatable :: x(:) 12 end type 13 14 type :: bar 15 type(foo) :: f 16 end type 17 18 class(bar), allocatable :: b 19 20 allocate(bar::b) 21 allocate(b%f%x(1000000)) 22 b%f%x = 1. 23 deallocate(b) 24 25end 26 27! { dg-final { scan-tree-dump-times "__builtin_free" 4 "original" } } 28! { dg-final { cleanup-tree-dump "original" } } 29