| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR fortran/90076 |
| 4 |
! |
| 5 |
! Contributed by Brad Richardson <[email protected]> |
| 6 |
! |
| 7 |
|
| 8 |
program assignment_memory_leak |
| 9 |
implicit none |
| 10 |
|
| 11 |
type, abstract :: base |
| 12 |
end type base |
| 13 |
|
| 14 |
type, extends(base) :: extended |
| 15 |
end type extended |
| 16 |
|
| 17 |
call run() |
| 18 |
contains |
| 19 |
subroutine run() |
| 20 |
class(base), allocatable :: var |
| 21 |
|
| 22 |
var = newVar() ! Crash fixed |
| 23 |
end subroutine run |
| 24 |
|
| 25 |
function newVar() |
| 26 |
class(extended), allocatable :: newVar |
| 27 |
end function newVar |
| 28 |
end program assignment_memory_leak |
| 29 |
|