summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/extends_14.f03
blob: f85f87ba6a5746ec9cf7f03e1abb57f70e23e985 (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 49466: [4.6/4.7 Regression] Memory leak with assignment of extended derived types
!
! Contributed by Rich Townsend <townsend@astro.wisc.edu>

program evolve_aflow

  implicit none

  type :: state_t
     real, allocatable :: U(:)
  end type

  type, extends(state_t) :: astate_t
  end type

 block ! New scoping unit as "a"/"b" are otherwise implicitly SAVEd
  type(astate_t) :: a,b

  allocate(a%U(1000))

  a = b
 end block
end program 

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