| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" } |
| 3 |
! { dg-additional-options "-latomic" { target libatomic_available } } |
| 4 |
! |
| 5 |
! Contributed by Ian Harvey <[email protected]> |
| 6 |
! Extended by Andre Vehreschild <[email protected]> |
| 7 |
! to test that coarray references in allocate work now |
| 8 |
! PR fortran/67451 |
| 9 |
|
| 10 |
program main |
| 11 |
implicit none |
| 12 |
type foo |
| 13 |
integer :: bar = 99 |
| 14 |
end type |
| 15 |
class(foo), dimension(:), allocatable :: foobar[:] |
| 16 |
class(foo), dimension(:), allocatable :: some_local_object |
| 17 |
allocate(foobar(10)[*]) |
| 18 |
|
| 19 |
allocate(some_local_object, source=foobar) |
| 20 |
|
| 21 |
if (.not. allocated(foobar)) STOP 1 |
| 22 |
if (lbound(foobar, 1) /= 1 .OR. ubound(foobar, 1) /= 10) STOP 2 |
| 23 |
if (.not. allocated(some_local_object)) STOP 3 |
| 24 |
if (any(some_local_object(:)%bar /= [99, 99, 99, 99, 99, 99, 99, 99, 99, 99])) STOP 4 |
| 25 |
|
| 26 |
deallocate(some_local_object) |
| 27 |
deallocate(foobar) |
| 28 |
end program |
| 29 |
|
| 30 |
! Check that some_local_object is treated as rank-1 array. |
| 31 |
! This failed beforehand, because the coarray attribute of the source=expression |
| 32 |
! was propagated to some_local_object in the allocate. |
| 33 |
! { dg-final { scan-tree-dump-not "some_local_object\._data\.dim\[1\]\.lbound" "original" } } |