| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdump-tree-original" } |
| 3 |
! |
| 4 |
! PR 49466: [4.6/4.7 Regression] Memory leak with assignment of extended derived types |
| 5 |
! |
| 6 |
! Contributed by Rich Townsend <[email protected]> |
| 7 |
|
| 8 |
program evolve_aflow |
| 9 |
|
| 10 |
implicit none |
| 11 |
|
| 12 |
type :: state_t |
| 13 |
real, allocatable :: U(:) |
| 14 |
end type |
| 15 |
|
| 16 |
type, extends(state_t) :: astate_t |
| 17 |
end type |
| 18 |
|
| 19 |
block ! New scoping unit as "a"/"b" are otherwise implicitly SAVEd |
| 20 |
type(astate_t) :: a,b |
| 21 |
|
| 22 |
allocate(a%U(1000)) |
| 23 |
|
| 24 |
a = b |
| 25 |
end block |
| 26 |
end program |
| 27 |
|
| 28 |
! { dg-final { scan-tree-dump-times "__builtin_free" 3 "original" } } |