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