1 ! RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=51
2 ! Check OpenMP clause validity for the following directives:
3 ! 2.10 Device constructs
7 real(8) :: arrayA(256), arrayB(256)
15 !$omp target map(arrayA)
21 !$omp target device(0)
27 !ERROR: At most one DEVICE clause can appear on the TARGET directive
28 !$omp target device(0) device(1)
34 !ERROR: SCHEDULE clause is not allowed on the TARGET directive
35 !$omp target schedule(static)
41 !$omp target defaultmap(tofrom:scalar)
47 !$omp target defaultmap(tofrom)
53 !ERROR: At most one DEFAULTMAP clause can appear on the TARGET directive
54 !$omp target defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
60 !$omp target thread_limit(4)
66 !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET directive
67 !$omp target thread_limit(4) thread_limit(8)
73 !$omp teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
79 !ERROR: At most one NUM_TEAMS clause can appear on the TEAMS directive
80 !$omp teams num_teams(2) num_teams(3)
86 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
87 !$omp teams num_teams(-1)
93 !ERROR: At most one THREAD_LIMIT clause can appear on the TEAMS directive
94 !$omp teams thread_limit(2) thread_limit(3)
100 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
101 !$omp teams thread_limit(-1)
107 !ERROR: At most one DEFAULT clause can appear on the TEAMS directive
108 !$omp teams default(shared) default(private)
114 !$omp target teams num_teams(2) defaultmap(tofrom:scalar)
118 !$omp end target teams
120 !$omp target map(tofrom:a)
126 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET directive
127 !$omp target map(delete:a)
133 !$omp target data device(0) map(to:a)
137 !$omp end target data
139 !$omp target data device(0) use_device_addr(cptr)
141 !$omp end target data
143 !$omp target data device(0) use_device_addr(cptr)
145 !$omp end target data
147 !ERROR: At least one of MAP, USE_DEVICE_ADDR, USE_DEVICE_PTR clause must appear on the TARGET DATA directive
148 !$omp target data device(0)
152 !$omp end target data
154 !ERROR: The device expression of the DEVICE clause must be a positive integer expression
155 !$omp target enter data map(alloc:A) device(-2)
157 !ERROR: The device expression of the DEVICE clause must be a positive integer expression
158 !$omp target exit data map(delete:A) device(-2)
160 !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
161 !$omp target enter data map(to:a) if(.true.) if(.false.)
163 !ERROR: Only the TO, ALLOC map types are permitted for MAP clauses on the TARGET ENTER DATA directive
164 !$omp target enter data map(from:a)
166 !$omp target exit data map(delete:a)
168 !ERROR: At most one DEVICE clause can appear on the TARGET EXIT DATA directive
169 !$omp target exit data map(from:a) device(0) device(1)
171 !ERROR: Only the FROM, RELEASE, DELETE map types are permitted for MAP clauses on the TARGET EXIT DATA directive
172 !$omp target exit data map(to:a)
174 !$omp target update if(.true.) device(1) to(a) from(b) depend(inout:c) nowait
176 !ERROR: At most one IF clause can appear on the TARGET UPDATE directive
177 !$omp target update to(a) if(.true.) if(.false.)
179 !ERROR: At most one DEVICE clause can appear on the TARGET UPDATE directive
180 !$omp target update device(0) device(1) from(b)
183 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
202 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
203 !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive
204 !$omp distribute collapse(2) collapse(3)
217 !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive
218 !$omp distribute collapse(2) collapse(3)
231 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
232 !$omp distribute dist_schedule(static, 2)
241 !$omp distribute dist_schedule(static, 2)
250 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
251 !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive
252 !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)
261 !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive
262 !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)