3 ! This program does a correctness check for
4 ! ... = ARRAY[idx] and ... = SCALAR[idx]
9 ! FIXME: two/three has to be modified, test has to be checked and
10 ! diagnostic has to be removed
15 integer, parameter :: n
= 3
16 integer, parameter :: m
= 4
18 ! Allocatable coarrays
28 subroutine one(lb1
, lb2
)
29 integer, value
:: lb1
, lb2
31 integer :: i_sgn1
, i_sgn2
, i
, i_e
, i_s
, j
, j_e
, j_s
32 integer, allocatable
:: caf(:,:)[:]
33 integer, allocatable
:: a(:,:), b(:,:), c(:,:)
35 allocate(caf(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)[*], &
36 a(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1), &
37 b(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1), &
38 c(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1))
40 b
= reshape([(i
*33, i
= 1, size(b
))], shape(b
))
42 ! Whole array: ARRAY = ARRAY
46 if (this_image() == num_images()) then
51 c(:,:) = caf(:,:)[num_images()]
52 if (any (a
/= c
)) then
61 if (this_image() == num_images()) then
66 do i
= n
+lb1
-1, lb1
, -2
68 c(i
,j
) = caf(i
,j
)[num_images()]
72 do i
= lb1
, n
+lb1
-1, 2
74 c(i
,j
) = caf(i
,j
)[num_images()]
77 if (any (a
/= c
)) then
82 ! Array sections with different ranges and pos/neg strides
95 if (this_image() == num_images()) then
99 a(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
) &
100 = b(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
)
101 c(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
) &
102 = caf(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
)[num_images()]
103 if (any (c
/= a
)) then
118 integer, parameter :: lb1
= -5, lb2
= 1
120 integer :: i_sgn1
, i_sgn2
, i
, i_e
, i_s
, j
, j_e
, j_s
121 integer, save :: caf(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)[*]
122 integer, save :: a(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)
123 integer, save :: b(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)
124 integer, save :: c(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)
126 b
= reshape([(i
*33, i
= 1, size(b
))], shape(b
))
128 ! Whole array: ARRAY = ARRAY
132 if (this_image() == num_images()) then
137 c(:,:) = caf(:,:)[num_images()]
138 if (any (a
/= c
)) then
147 if (this_image() == num_images()) then
152 do i
= n
+lb1
-1, lb1
, -2
154 c(i
,j
) = caf(i
,j
)[num_images()]
158 do i
= lb1
, n
+lb1
-1, 2
160 c(i
,j
) = caf(i
,j
)[num_images()]
163 if (any (a
/= c
)) then
168 ! Array sections with different ranges and pos/neg strides
181 if (this_image() == num_images()) then
185 a(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
) &
186 = b(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
)
187 c(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
) &
188 = caf(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
)[num_images()]
189 if (any (c
/= a
)) then
204 integer, parameter :: lb1
= 0, lb2
= 0
206 integer :: i_sgn1
, i_sgn2
, i
, i_e
, i_s
, j
, j_e
, j_s
207 integer, save :: caf(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)[*]
208 integer, save :: a(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)
209 integer, save :: b(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)
210 integer, save :: c(lb1
:n
+lb1
-1, lb2
:m
+lb2
-1)
212 b
= reshape([(i
*33, i
= 1, size(b
))], shape(b
))
214 ! Whole array: ARRAY = ARRAY
218 if (this_image() == num_images()) then
223 c(:,:) = caf(:,:)[num_images()]
224 if (any (a
/= c
)) then
233 if (this_image() == num_images()) then
238 do i
= n
+lb1
-1, lb1
, -2
240 c(i
,j
) = caf(i
,j
)[num_images()]
244 do i
= lb1
, n
+lb1
-1, 2
246 c(i
,j
) = caf(i
,j
)[num_images()]
249 if (any (a
/= c
)) then
254 ! Array sections with different ranges and pos/neg strides
267 if (this_image() == num_images()) then
271 a(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
) &
272 = b(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
)
273 c(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
) &
274 = caf(i
:i_e
:i_s
*i_sgn1
, j
:j_e
:j_s
*i_sgn2
)[num_images()]
275 if (any (c
/= a
)) then