1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2 ! Check OpenMP clause validity for the following directives:
3 ! 2.10 Device constructs
6 real(8) :: arrayA(256), arrayB(256)
13 !$omp target map(arrayA)
19 !$omp target device(0)
25 !ERROR: At most one DEVICE clause can appear on the TARGET directive
26 !$omp target device(0) device(1)
32 !ERROR: SCHEDULE clause is not allowed on the TARGET directive
33 !$omp target schedule(static)
39 !$omp target defaultmap(tofrom:scalar)
45 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
46 !$omp target defaultmap(tofrom)
52 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET directive
53 !$omp target defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
59 !$omp target thread_limit(4)
65 !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET directive
66 !$omp target thread_limit(4) thread_limit(8)
72 !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
78 !ERROR: At most one NUM_TEAMS clause can appear on the TEAMS directive
79 !$omp teams num_teams(2) num_teams(3)
85 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
86 !$omp teams num_teams(-1)
92 !ERROR: At most one THREAD_LIMIT clause can appear on the TEAMS directive
93 !$omp teams thread_limit(2) thread_limit(3)
99 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
100 !$omp teams thread_limit(-1)
106 !ERROR: At most one DEFAULT clause can appear on the TEAMS directive
107 !$omp teams default(shared) default(private)
113 !$omp target teams num_teams(2) defaultmap(tofrom:scalar)
117 !$omp end target teams
119 !$omp target map(tofrom:a)
125 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET directive
126 !$omp target map(delete:a)
132 !$omp target data device(0) map(to:a)
136 !$omp end target data
138 !ERROR: At least one of MAP clause must appear on the TARGET DATA directive
139 !$omp target data device(0)
143 !$omp end target data
145 !ERROR: The device expression of the DEVICE clause must be a positive integer expression
146 !$omp target enter data map(alloc:A) device(-2)
148 !ERROR: The device expression of the DEVICE clause must be a positive integer expression
149 !$omp target exit data map(delete:A) device(-2)
151 !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
152 !$omp target enter data map(to:a) if(.true.) if(.false.)
154 !ERROR: Only the TO, ALLOC map types are permitted for MAP clauses on the TARGET ENTER DATA directive
155 !$omp target enter data map(from:a)
157 !$omp target exit data map(delete:a)
159 !ERROR: At most one DEVICE clause can appear on the TARGET EXIT DATA directive
160 !$omp target exit data map(from:a) device(0) device(1)
162 !ERROR: Only the FROM, RELEASE, DELETE map types are permitted for MAP clauses on the TARGET EXIT DATA directive
163 !$omp target exit data map(to:a)
165 !$omp target update if(.true.) device(1) to(a) from(b) depend(inout:c) nowait
167 !ERROR: At most one IF clause can appear on the TARGET UPDATE directive
168 !$omp target update to(a) if(.true.) if(.false.)
170 !ERROR: At most one DEVICE clause can appear on the TARGET UPDATE directive
171 !$omp target update device(0) device(1) from(b)
174 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
193 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
194 !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive
195 !$omp distribute collapse(2) collapse(3)
208 !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive
209 !$omp distribute collapse(2) collapse(3)
222 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
223 !$omp distribute dist_schedule(static, 2)
232 !$omp distribute dist_schedule(static, 2)
241 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
242 !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive
243 !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)
252 !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive
253 !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)