| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-fcoarray=lib -lcaf_single -fdump-tree-original" } |
| 3 |
! { dg-additional-options "-latomic" { target libatomic_available } } |
| 4 |
|
| 5 |
program alloc_comp |
| 6 |
implicit none |
| 7 |
|
| 8 |
type coords |
| 9 |
real,allocatable :: x(:) |
| 10 |
real,allocatable :: y(:) |
| 11 |
real,allocatable :: z(:) |
| 12 |
end type |
| 13 |
|
| 14 |
integer :: me,np,n,i |
| 15 |
type(coords) :: coo[*] |
| 16 |
|
| 17 |
! with caf_single num_images is always == 1 |
| 18 |
me = this_image(); np = num_images() |
| 19 |
n = 100 |
| 20 |
|
| 21 |
allocate(coo%x(n),coo%y(n),coo%z(n)) |
| 22 |
|
| 23 |
coo%y = me |
| 24 |
|
| 25 |
do i=1, n |
| 26 |
coo%y(i) = coo%y(i) + i |
| 27 |
end do |
| 28 |
|
| 29 |
sync all |
| 30 |
|
| 31 |
! Check the caf_get()-offset is computed correctly. |
| 32 |
if(me == 1 .and. coo[np]%y(10) /= 11 ) STOP 1 |
| 33 |
|
| 34 |
! Check the whole array is correct. |
| 35 |
if (me == 1 .and. any( coo[np]%y /= [(i, i=2, 101)] ) ) STOP 2 |
| 36 |
|
| 37 |
deallocate(coo%x) |
| 38 |
|
| 39 |
end program |