1! RUN: %python %S/../test_errors.py %s %flang -fopenmp
2
3program main
4  implicit none
5  integer :: N
6  integer :: i
7  real(8) :: a(256), b(256)
8  N = 256
9
10  !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
11  !$omp distribute simd
12  do i = 1, N
13     a(i) = 3.14
14  enddo
15  !$omp end distribute simd
16
17  !$omp target parallel device(0)
18  do i = 1, N
19     a(i) = 3.14
20  enddo
21  !$omp end target parallel
22
23  !ERROR: At most one DEVICE clause can appear on the TARGET PARALLEL directive
24  !$omp target parallel device(0) device(1)
25  do i = 1, N
26     a(i) = 3.14
27  enddo
28  !$omp end target parallel
29
30  !$omp target parallel defaultmap(tofrom:scalar)
31  do i = 1, N
32     a(i) = 3.14
33  enddo
34  !$omp end target parallel
35
36  !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
37  !$omp target parallel defaultmap(tofrom)
38  do i = 1, N
39     a(i) = 3.14
40  enddo
41  !$omp end target parallel
42
43  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET PARALLEL directive
44  !$omp target parallel defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
45  do i = 1, N
46     a(i) = 3.14
47  enddo
48  !$omp end target parallel
49
50  !$omp target parallel map(tofrom:a)
51  do i = 1, N
52     a(i) = 3.14
53  enddo
54  !$omp end target parallel
55
56  !ERROR: COPYIN clause is not allowed on the TARGET PARALLEL directive
57  !ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause
58  !$omp target parallel copyin(a)
59  do i = 1, N
60     a(i) = 3.14
61  enddo
62  !$omp end target parallel
63
64  !$omp target parallel do device(0)
65  do i = 1, N
66     a(i) = 3.14
67  enddo
68  !$omp end target parallel do
69
70  !ERROR: At most one DEVICE clause can appear on the TARGET PARALLEL DO directive
71  !$omp target parallel do device(0) device(1)
72  do i = 1, N
73     a(i) = 3.14
74  enddo
75  !$omp end target parallel do
76
77  !$omp target parallel do defaultmap(tofrom:scalar)
78  do i = 1, N
79     a(i) = 3.14
80  enddo
81  !$omp end target parallel do
82
83  !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
84  !$omp target parallel do defaultmap(tofrom)
85  do i = 1, N
86     a(i) = 3.14
87  enddo
88  !$omp end target parallel do
89
90  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET PARALLEL DO directive
91  !$omp target parallel do defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
92  do i = 1, N
93     a(i) = 3.14
94  enddo
95  !$omp end target parallel do
96
97  !$omp target parallel do map(tofrom:a)
98  do i = 1, N
99     a(i) = 3.14
100  enddo
101  !$omp end target parallel do
102
103  !ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause
104  !$omp target parallel do copyin(a)
105  do i = 1, N
106     a(i) = 3.14
107  enddo
108  !$omp end target parallel do
109
110  !$omp target teams map(a)
111  do i = 1, N
112     a(i) = 3.14
113  enddo
114  !$omp end target teams
115
116  !$omp target teams device(0)
117  do i = 1, N
118     a(i) = 3.14
119  enddo
120  !$omp end target teams
121
122  !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS directive
123  !$omp target teams device(0) device(1)
124  do i = 1, N
125     a(i) = 3.14
126  enddo
127  !$omp end target teams
128
129  !ERROR: SCHEDULE clause is not allowed on the TARGET TEAMS directive
130  !$omp target teams schedule(static)
131  do i = 1, N
132     a(i) = 3.14
133  enddo
134  !$omp end target teams
135
136  !$omp target teams defaultmap(tofrom:scalar)
137  do i = 1, N
138     a(i) = 3.14
139  enddo
140  !$omp end target teams
141
142  !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
143  !$omp target teams defaultmap(tofrom)
144  do i = 1, N
145     a(i) = 3.14
146  enddo
147  !$omp end target teams
148
149  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS directive
150  !$omp target teams defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
151  do i = 1, N
152     a(i) = 3.14
153  enddo
154  !$omp end target teams
155
156  !$omp target teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
157  do i = 1, N
158     a(i) = 3.14
159  enddo
160  !$omp end target teams
161
162  !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS directive
163  !$omp target teams num_teams(2) num_teams(3)
164  do i = 1, N
165     a(i) = 3.14
166  enddo
167  !$omp end target teams
168
169  !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
170  !$omp target teams num_teams(-1)
171  do i = 1, N
172     a(i) = 3.14
173  enddo
174  !$omp end target teams
175
176  !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS directive
177  !$omp target teams thread_limit(2) thread_limit(3)
178  do i = 1, N
179     a(i) = 3.14
180  enddo
181  !$omp end target teams
182
183  !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
184  !$omp target teams thread_limit(-1)
185  do i = 1, N
186     a(i) = 3.14
187  enddo
188  !$omp end target teams
189
190  !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS directive
191  !$omp target teams default(shared) default(private)
192  do i = 1, N
193     a(i) = 3.14
194  enddo
195  !$omp end target teams
196
197  !$omp target teams num_teams(2) defaultmap(tofrom:scalar)
198  do i = 1, N
199      a(i) = 3.14
200  enddo
201  !$omp end target teams
202
203  !$omp target teams map(tofrom:a)
204  do i = 1, N
205     a(i) = 3.14
206  enddo
207  !$omp end target teams
208
209  !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS directive
210  !$omp target teams map(delete:a)
211  do i = 1, N
212     a(i) = 3.14
213  enddo
214  !$omp end target teams
215
216
217  !$omp target teams distribute map(a)
218  do i = 1, N
219     a(i) = 3.14
220  enddo
221  !$omp end target teams distribute
222
223  !$omp target teams distribute device(0)
224  do i = 1, N
225     a(i) = 3.14
226  enddo
227  !$omp end target teams distribute
228
229  !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS DISTRIBUTE directive
230  !$omp target teams distribute device(0) device(1)
231  do i = 1, N
232     a(i) = 3.14
233  enddo
234  !$omp end target teams distribute
235
236  !$omp target teams distribute defaultmap(tofrom:scalar)
237  do i = 1, N
238     a(i) = 3.14
239  enddo
240  !$omp end target teams distribute
241
242  !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
243  !$omp target teams distribute defaultmap(tofrom)
244  do i = 1, N
245     a(i) = 3.14
246  enddo
247  !$omp end target teams distribute
248
249  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS DISTRIBUTE directive
250  !$omp target teams distribute defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
251  do i = 1, N
252     a(i) = 3.14
253  enddo
254  !$omp end target teams distribute
255
256  !$omp target teams distribute num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
257  do i = 1, N
258     a(i) = 3.14
259  enddo
260  !$omp end target teams distribute
261
262  !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS DISTRIBUTE directive
263  !$omp target teams distribute num_teams(2) num_teams(3)
264  do i = 1, N
265     a(i) = 3.14
266  enddo
267  !$omp end target teams distribute
268
269  !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
270  !$omp target teams distribute num_teams(-1)
271  do i = 1, N
272     a(i) = 3.14
273  enddo
274  !$omp end target teams distribute
275
276  !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS DISTRIBUTE directive
277  !$omp target teams distribute thread_limit(2) thread_limit(3)
278  do i = 1, N
279     a(i) = 3.14
280  enddo
281  !$omp end target teams distribute
282
283  !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
284  !$omp target teams distribute thread_limit(-1)
285  do i = 1, N
286     a(i) = 3.14
287  enddo
288  !$omp end target teams distribute
289
290  !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS DISTRIBUTE directive
291  !$omp target teams distribute default(shared) default(private)
292  do i = 1, N
293     a(i) = 3.14
294  enddo
295  !$omp end target teams distribute
296
297  !$omp target teams distribute num_teams(2) defaultmap(tofrom:scalar)
298  do i = 1, N
299      a(i) = 3.14
300  enddo
301  !$omp end target teams distribute
302
303  !$omp target teams distribute map(tofrom:a)
304  do i = 1, N
305     a(i) = 3.14
306  enddo
307  !$omp end target teams distribute
308
309  !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS DISTRIBUTE directive
310  !$omp target teams distribute map(delete:a)
311  do i = 1, N
312     a(i) = 3.14
313  enddo
314  !$omp end target teams distribute
315
316  !$omp target teams distribute parallel do device(0)
317  do i = 1, N
318     a(i) = 3.14
319  enddo
320  !$omp end target teams distribute parallel do
321
322  !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
323  !$omp target teams distribute parallel do device(0) device(1)
324  do i = 1, N
325     a(i) = 3.14
326  enddo
327  !$omp end target teams distribute parallel do
328
329  !$omp target teams distribute parallel do defaultmap(tofrom:scalar)
330  do i = 1, N
331     a(i) = 3.14
332  enddo
333  !$omp end target teams distribute parallel do
334
335  !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
336  !$omp target teams distribute parallel do defaultmap(tofrom)
337  do i = 1, N
338     a(i) = 3.14
339  enddo
340  !$omp end target teams distribute parallel do
341
342  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
343  !$omp target teams distribute parallel do defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
344  do i = 1, N
345     a(i) = 3.14
346  enddo
347  !$omp end target teams distribute parallel do
348
349  !$omp target teams distribute parallel do num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
350  do i = 1, N
351     a(i) = 3.14
352  enddo
353  !$omp end target teams distribute parallel do
354
355  !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
356  !$omp target teams distribute parallel do num_teams(2) num_teams(3)
357  do i = 1, N
358     a(i) = 3.14
359  enddo
360  !$omp end target teams distribute parallel do
361
362  !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
363  !$omp target teams distribute parallel do num_teams(-1)
364  do i = 1, N
365     a(i) = 3.14
366  enddo
367  !$omp end target teams distribute parallel do
368
369  !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
370  !$omp target teams distribute parallel do thread_limit(2) thread_limit(3)
371  do i = 1, N
372     a(i) = 3.14
373  enddo
374  !$omp end target teams distribute parallel do
375
376  !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
377  !$omp target teams distribute parallel do thread_limit(-1)
378  do i = 1, N
379     a(i) = 3.14
380  enddo
381  !$omp end target teams distribute parallel do
382
383  !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
384  !$omp target teams distribute parallel do default(shared) default(private)
385  do i = 1, N
386     a(i) = 3.14
387  enddo
388  !$omp end target teams distribute parallel do
389
390  !$omp target teams distribute parallel do num_teams(2) defaultmap(tofrom:scalar)
391  do i = 1, N
392      a(i) = 3.14
393  enddo
394  !$omp end target teams distribute parallel do
395
396  !$omp target teams distribute parallel do map(tofrom:a)
397  do i = 1, N
398     a(i) = 3.14
399  enddo
400  !$omp end target teams distribute parallel do
401
402  !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS DISTRIBUTE PARALLEL DO directive
403  !$omp target teams distribute parallel do map(delete:a)
404  do i = 1, N
405     a(i) = 3.14
406  enddo
407  !$omp end target teams distribute parallel do
408
409
410  !$omp target teams distribute parallel do simd map(a)
411  do i = 1, N
412     a(i) = 3.14
413  enddo
414  !$omp end target teams distribute parallel do simd
415
416  !$omp target teams distribute parallel do simd device(0)
417  do i = 1, N
418     a(i) = 3.14
419  enddo
420  !$omp end target teams distribute parallel do simd
421
422  !ERROR: At most one DEVICE clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
423  !$omp target teams distribute parallel do simd device(0) device(1)
424  do i = 1, N
425     a(i) = 3.14
426  enddo
427  !$omp end target teams distribute parallel do simd
428
429  !$omp target teams distribute parallel do simd defaultmap(tofrom:scalar)
430  do i = 1, N
431     a(i) = 3.14
432  enddo
433  !$omp end target teams distribute parallel do simd
434
435  !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
436  !$omp target teams distribute parallel do simd defaultmap(tofrom)
437  do i = 1, N
438     a(i) = 3.14
439  enddo
440  !$omp end target teams distribute parallel do simd
441
442  !ERROR: At most one DEFAULTMAP clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
443  !$omp target teams distribute parallel do simd defaultmap(tofrom:scalar) defaultmap(tofrom:scalar)
444  do i = 1, N
445     a(i) = 3.14
446  enddo
447  !$omp end target teams distribute parallel do simd
448
449  !$omp target teams distribute parallel do simd num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
450  do i = 1, N
451     a(i) = 3.14
452  enddo
453  !$omp end target teams distribute parallel do simd
454
455  !ERROR: At most one NUM_TEAMS clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
456  !$omp target teams distribute parallel do simd num_teams(2) num_teams(3)
457  do i = 1, N
458     a(i) = 3.14
459  enddo
460  !$omp end target teams distribute parallel do simd
461
462  !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
463  !$omp target teams distribute parallel do simd num_teams(-1)
464  do i = 1, N
465     a(i) = 3.14
466  enddo
467  !$omp end target teams distribute parallel do simd
468
469  !ERROR: At most one THREAD_LIMIT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
470  !$omp target teams distribute parallel do simd thread_limit(2) thread_limit(3)
471  do i = 1, N
472     a(i) = 3.14
473  enddo
474  !$omp end target teams distribute parallel do simd
475
476  !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
477  !$omp target teams distribute parallel do simd thread_limit(-1)
478  do i = 1, N
479     a(i) = 3.14
480  enddo
481  !$omp end target teams distribute parallel do simd
482
483  !ERROR: At most one DEFAULT clause can appear on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
484  !$omp target teams distribute parallel do simd default(shared) default(private)
485  do i = 1, N
486     a(i) = 3.14
487  enddo
488  !$omp end target teams distribute parallel do simd
489
490  !$omp target teams distribute parallel do simd num_teams(2) defaultmap(tofrom:scalar)
491  do i = 1, N
492      a(i) = 3.14
493  enddo
494  !$omp end target teams distribute parallel do simd
495
496  !$omp target teams distribute parallel do simd map(tofrom:a)
497  do i = 1, N
498     a(i) = 3.14
499  enddo
500  !$omp end target teams distribute parallel do simd
501
502  !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD directive
503  !$omp target teams distribute parallel do simd map(delete:a)
504  do i = 1, N
505     a(i) = 3.14
506  enddo
507  !$omp end target teams distribute parallel do simd
508
509
510end program main
511
512