1 ! RUN: %python %S/../test_errors.py %s %flang -fopenacc
3 ! Check OpenACC clause validity for the following construct and directive:
6 program openacc_loop_validity
11 real(8), dimension(10) :: arr
15 integer :: i
, j
, b
, gang_size
, vector_size
, worker_size
16 integer, parameter :: N
= 256
17 integer, dimension(N
) :: c
18 logical, dimension(N
) :: d
, e
20 integer :: wait1
, wait2
22 logical :: reduction_l
23 real(8), dimension(N
, N
) :: aa
, bb
, cc
24 logical :: ifCondition
= .TRUE
.
26 type(atype
), dimension(10) :: ta
28 real(8), dimension(N
) :: a
, f
, g
, h
37 !$acc parallel device_type(*) num_gangs(2)
52 !$acc loop independent
66 !ERROR: At most one VECTOR clause can appear on the LOOP directive
67 !$acc loop vector vector(128)
88 !$acc loop vector(vector_size)
95 !$acc loop vector(length: vector_size)
102 !ERROR: At most one WORKER clause can appear on the LOOP directive
103 !$acc loop worker worker(10)
117 !$acc loop worker(10)
124 !$acc loop worker(worker_size)
131 !$acc loop worker(num: worker_size)
138 !ERROR: At most one GANG clause can appear on the LOOP directive
139 !$acc loop gang gang(gang_size)
146 !$acc loop gang(gang_size)
153 !$acc loop gang(num: gang_size)
160 !$acc loop gang(gang_size, static:*)
167 !$acc loop gang(num: gang_size, static:*)
174 !$acc loop gang(num: gang_size, static: gang_size)
181 !$acc loop private(b, a(:))
195 !$acc loop tile(2, 2)
204 !ERROR: The parameter of the COLLAPSE clause must be a constant positive integer expression
205 !$acc loop collapse(-1)
214 !ERROR: Clause PRIVATE is not allowed after clause DEVICE_TYPE on the LOOP directive
215 !$acc loop device_type(*) private(i)
222 !ERROR: Clause GANG is not allowed if clause SEQ appears on the LOOP directive
230 !ERROR: Clause WORKER is not allowed if clause SEQ appears on the LOOP directive
231 !$acc loop worker seq
238 !ERROR: Clause VECTOR is not allowed if clause SEQ appears on the LOOP directive
239 !$acc loop vector seq
245 !ERROR: Clause IF is not allowed after clause DEVICE_TYPE on the PARALLEL directive
246 !$acc parallel device_type(*) if(.TRUE.)
253 end program openacc_loop_validity