1 ! RUN: %S/test_errors.sh %s %t %flang -fopenmp
3 ! Check OpenMP clause validity for the following directives:
4 ! 2.10 Device constructs
7 real(8) :: arrayA(256), arrayB(256)
14 !$omp target map(arrayA)
20 !$omp target device(0)
26 !ERROR: At most one DEVICE clause can appear on the TARGET directive
27 !$omp target device(0) device(1)
33 !ERROR: SCHEDULE clause is not allowed on the TARGET directive
34 !$omp target schedule(static)
40 !$omp target defaultmap(tofrom:scalar)
46 !ERROR: The argument TOFROM:SCALAR must be specified on the DEFAULTMAP clause
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 teams num_teams(3) thread_limit(10) default(shared) private(i) shared(a)
66 !ERROR: At most one NUM_TEAMS clause can appear on the TEAMS directive
67 !$omp teams num_teams(2) num_teams(3)
73 !ERROR: The parameter of the NUM_TEAMS clause must be a positive integer expression
74 !$omp teams num_teams(-1)
80 !ERROR: At most one THREAD_LIMIT clause can appear on the TEAMS directive
81 !$omp teams thread_limit(2) thread_limit(3)
87 !ERROR: The parameter of the THREAD_LIMIT clause must be a positive integer expression
88 !$omp teams thread_limit(-1)
94 !ERROR: At most one DEFAULT clause can appear on the TEAMS directive
95 !$omp teams default(shared) default(private)
101 !$omp target teams num_teams(2) defaultmap(tofrom:scalar)
105 !$omp end target teams
107 !$omp target map(tofrom:a)
113 !ERROR: Only the TO, FROM, TOFROM, ALLOC map types are permitted for MAP clauses on the TARGET directive
114 !$omp target map(delete:a)
120 !$omp target data device(0) map(to:a)
124 !$omp end target data
126 !ERROR: At least one of MAP clause must appear on the TARGET DATA directive
127 !$omp target data device(0)
131 !$omp end target data
133 !ERROR: At most one IF clause can appear on the TARGET ENTER DATA directive
134 !$omp target enter data map(to:a) if(.true.) if(.false.)
136 !ERROR: Only the TO, ALLOC map types are permitted for MAP clauses on the TARGET ENTER DATA directive
137 !$omp target enter data map(from:a)
139 !$omp target exit data map(delete:a)
141 !ERROR: At most one DEVICE clause can appear on the TARGET EXIT DATA directive
142 !$omp target exit data map(from:a) device(0) device(1)
144 !ERROR: Only the FROM, RELEASE, DELETE map types are permitted for MAP clauses on the TARGET EXIT DATA directive
145 !$omp target exit data map(to:a)
148 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
167 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
168 !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive
169 !$omp distribute collapse(2) collapse(3)
182 !ERROR: At most one COLLAPSE clause can appear on the DISTRIBUTE directive
183 !$omp distribute collapse(2) collapse(3)
196 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
197 !$omp distribute dist_schedule(static, 2)
206 !$omp distribute dist_schedule(static, 2)
215 !ERROR: `DISTRIBUTE` region has to be strictly nested inside `TEAMS` region.
216 !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive
217 !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)
226 !ERROR: At most one DIST_SCHEDULE clause can appear on the DISTRIBUTE directive
227 !$omp distribute dist_schedule(static, 2) dist_schedule(static, 3)