| 1 |
! { dg-do run } |
| 2 |
! |
| 3 |
! PR 45004: [OOP] Segfault with allocatable scalars and move_alloc |
| 4 |
! |
| 5 |
! Contributed by Salvatore Filippone <[email protected]> |
| 6 |
|
| 7 |
program bug18 |
| 8 |
|
| 9 |
type foo |
| 10 |
integer :: i |
| 11 |
end type foo |
| 12 |
|
| 13 |
type bar |
| 14 |
class(foo), allocatable :: bf |
| 15 |
end type bar |
| 16 |
|
| 17 |
class(foo), allocatable :: afab |
| 18 |
type(bar) :: bb |
| 19 |
|
| 20 |
allocate(foo :: afab) |
| 21 |
afab%i = 8 |
| 22 |
call move_alloc(afab, bb%bf) |
| 23 |
if (.not. allocated(bb%bf)) STOP 1 |
| 24 |
if (allocated(afab)) STOP 2 |
| 25 |
if (bb%bf%i/=8) STOP 3 |
| 26 |
|
| 27 |
end program bug18 |