| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
program alloc_comp_6 |
| 4 |
|
| 5 |
implicit none |
| 6 |
|
| 7 |
type :: foo |
| 8 |
real :: x |
| 9 |
integer, allocatable :: y(:) |
| 10 |
end type |
| 11 |
|
| 12 |
call check() |
| 13 |
|
| 14 |
contains |
| 15 |
|
| 16 |
subroutine check() |
| 17 |
block |
| 18 |
type(foo), allocatable :: example[:] ! needs to be a coarray |
| 19 |
|
| 20 |
allocate(example[*]) |
| 21 |
allocate(example%y(10)) |
| 22 |
example%x = 3.4 |
| 23 |
example%y = 4 |
| 24 |
|
| 25 |
deallocate(example) |
| 26 |
end block ! example%y shall not be accessed here by the finalizer, |
| 27 |
! because example is already deallocated |
| 28 |
end subroutine check |
| 29 |
end program alloc_comp_6 |