1! { dg-do run } 2! { dg-options "-fdump-tree-original" } 3! 4! PR 42647: Missed initialization/dealloc of allocatable scalar DT with allocatable component 5! 6! Contributed by Tobias Burnus <burnus@gcc.gnu.org> 7 8module m 9type st 10 integer , allocatable :: a1 11end type st 12type at 13 integer , allocatable :: a2(:) 14end type at 15 16type t1 17 type(st), allocatable :: b1 18end type t1 19type t2 20 type(st), allocatable :: b2(:) 21end type t2 22type t3 23 type(at), allocatable :: b3 24end type t3 25type t4 26 type(at), allocatable :: b4(:) 27end type t4 28end module m 29 30use m 31block ! Start new scoping unit as otherwise the vars are implicitly SAVEd 32type(t1) :: na1, a1, aa1(:) 33type(t2) :: na2, a2, aa2(:) 34type(t3) :: na3, a3, aa3(:) 35type(t4) :: na4, a4, aa4(:) 36 37allocatable :: a1, a2, a3, a4, aa1, aa2, aa3,aa4 38 39if(allocated(a1)) STOP 1 40if(allocated(a2)) STOP 2 41if(allocated(a3)) STOP 3 42if(allocated(a4)) STOP 4 43if(allocated(aa1)) STOP 5 44if(allocated(aa2)) STOP 6 45if(allocated(aa3)) STOP 7 46if(allocated(aa4)) STOP 8 47 48if(allocated(na1%b1)) STOP 9 49if(allocated(na2%b2)) STOP 10 50if(allocated(na3%b3)) STOP 11 51if(allocated(na4%b4)) STOP 12 52end block 53end 54 55! { dg-final { scan-tree-dump-times "__builtin_free" 54 "original" } } 56