1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
3 ! Semantic checks for OpenMP 5.0 standard 2.17.7 atomic Construct.
7 integer :: i
, j
= 10, k
=-100, a
9 ! Handled inside parser.
10 ! OpenMP constructs may not be encountered during execution of an atomic region
13 ! At most one memory-order-clause may appear on the construct.
16 !ERROR: At most one SEQ_CST clause can appear on the READ directive
17 !$omp atomic seq_cst seq_cst read
19 !ERROR: At most one SEQ_CST clause can appear on the READ directive
20 !$omp atomic read seq_cst seq_cst
22 !ERROR: At most one SEQ_CST clause can appear on the READ directive
23 !$omp atomic seq_cst read seq_cst
26 !ERROR: At most one ACQUIRE clause can appear on the READ directive
27 !$omp atomic acquire acquire read
29 !ERROR: At most one ACQUIRE clause can appear on the READ directive
30 !$omp atomic read acquire acquire
32 !ERROR: At most one ACQUIRE clause can appear on the READ directive
33 !$omp atomic acquire read acquire
36 !ERROR: At most one RELAXED clause can appear on the READ directive
37 !$omp atomic relaxed relaxed read
39 !ERROR: At most one RELAXED clause can appear on the READ directive
40 !$omp atomic read relaxed relaxed
42 !ERROR: At most one RELAXED clause can appear on the READ directive
43 !$omp atomic relaxed read relaxed
47 !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
48 !$omp atomic seq_cst seq_cst update
50 !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
51 !$omp atomic update seq_cst seq_cst
53 !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
54 !$omp atomic seq_cst update seq_cst
57 !ERROR: At most one RELEASE clause can appear on the UPDATE directive
58 !$omp atomic release release update
60 !ERROR: At most one RELEASE clause can appear on the UPDATE directive
61 !$omp atomic update release release
63 !ERROR: At most one RELEASE clause can appear on the UPDATE directive
64 !$omp atomic release update release
67 !ERROR: At most one RELAXED clause can appear on the UPDATE directive
68 !$omp atomic relaxed relaxed update
70 !ERROR: At most one RELAXED clause can appear on the UPDATE directive
71 !$omp atomic update relaxed relaxed
73 !ERROR: At most one RELAXED clause can appear on the UPDATE directive
74 !$omp atomic relaxed update relaxed
78 !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
79 !$omp atomic seq_cst seq_cst capture
84 !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
85 !$omp atomic capture seq_cst seq_cst
90 !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
91 !$omp atomic seq_cst capture seq_cst
96 !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
97 !$omp atomic release release capture
102 !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
103 !$omp atomic capture release release
108 !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
109 !$omp atomic release capture release
114 !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
115 !$omp atomic relaxed relaxed capture
120 !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
121 !$omp atomic capture relaxed relaxed
126 !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
127 !$omp atomic relaxed capture relaxed
132 !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
133 !$omp atomic acq_rel acq_rel capture
138 !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
139 !$omp atomic capture acq_rel acq_rel
144 !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
145 !$omp atomic acq_rel capture acq_rel
150 !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
151 !$omp atomic acquire acquire capture
156 !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
157 !$omp atomic capture acquire acquire
162 !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
163 !$omp atomic acquire capture acquire
169 !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
170 !$omp atomic seq_cst seq_cst write
172 !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
173 !$omp atomic write seq_cst seq_cst
175 !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
176 !$omp atomic seq_cst write seq_cst
179 !ERROR: At most one RELEASE clause can appear on the WRITE directive
180 !$omp atomic release release write
182 !ERROR: At most one RELEASE clause can appear on the WRITE directive
183 !$omp atomic write release release
185 !ERROR: At most one RELEASE clause can appear on the WRITE directive
186 !$omp atomic release write release
189 !ERROR: At most one RELAXED clause can appear on the WRITE directive
190 !$omp atomic relaxed relaxed write
192 !ERROR: At most one RELAXED clause can appear on the WRITE directive
193 !$omp atomic write relaxed relaxed
195 !ERROR: At most one RELAXED clause can appear on the WRITE directive
196 !$omp atomic relaxed write relaxed
200 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive
201 !$omp atomic relaxed relaxed
203 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive
204 !$omp atomic seq_cst seq_cst
206 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive
207 !$omp atomic release release
211 ! At most one hint clause may appear on the construct.
213 !ERROR: At most one HINT clause can appear on the READ directive
214 !$omp atomic hint(omp_sync_hint_speculative) hint(omp_sync_hint_speculative) read
216 !ERROR: At most one HINT clause can appear on the READ directive
217 !$omp atomic hint(omp_sync_hint_nonspeculative) read hint(omp_sync_hint_nonspeculative)
219 !ERROR: At most one HINT clause can appear on the READ directive
220 !$omp atomic read hint(omp_sync_hint_uncontended) hint (omp_sync_hint_uncontended)
222 !ERROR: At most one HINT clause can appear on the WRITE directive
223 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write
225 !ERROR: At most one HINT clause can appear on the WRITE directive
226 !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)
228 !ERROR: At most one HINT clause can appear on the WRITE directive
229 !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
231 !ERROR: At most one HINT clause can appear on the WRITE directive
232 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write
234 !ERROR: At most one HINT clause can appear on the WRITE directive
235 !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)
237 !ERROR: At most one HINT clause can appear on the WRITE directive
238 !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
240 !ERROR: At most one HINT clause can appear on the UPDATE directive
241 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) update
243 !ERROR: At most one HINT clause can appear on the UPDATE directive
244 !$omp atomic hint(omp_sync_hint_nonspeculative) update hint(omp_sync_hint_nonspeculative)
246 !ERROR: At most one HINT clause can appear on the UPDATE directive
247 !$omp atomic update hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
249 !ERROR: At most one HINT clause can appear on the ATOMIC directive
250 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative)
252 !ERROR: At most one HINT clause can appear on the ATOMIC directive
253 !$omp atomic hint(omp_sync_hint_none) hint(omp_sync_hint_nonspeculative)
255 !ERROR: At most one HINT clause can appear on the ATOMIC directive
256 !$omp atomic hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
259 !ERROR: At most one HINT clause can appear on the CAPTURE directive
260 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) capture
264 !ERROR: At most one HINT clause can appear on the CAPTURE directive
265 !$omp atomic hint(omp_sync_hint_nonspeculative) capture hint(omp_sync_hint_nonspeculative)
269 !ERROR: At most one HINT clause can appear on the CAPTURE directive
270 !$omp atomic capture hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
275 ! If atomic-clause is read then memory-order-clause must not be acq_rel or release.
277 !ERROR: Clause ACQ_REL is not allowed if clause READ appears on the ATOMIC directive
278 !$omp atomic acq_rel read
280 !ERROR: Clause ACQ_REL is not allowed if clause READ appears on the ATOMIC directive
281 !$omp atomic read acq_rel
284 !ERROR: Clause RELEASE is not allowed if clause READ appears on the ATOMIC directive
285 !$omp atomic release read
287 !ERROR: Clause RELEASE is not allowed if clause READ appears on the ATOMIC directive
288 !$omp atomic read release
292 ! If atomic-clause is write then memory-order-clause must not be acq_rel or acquire.
294 !ERROR: Clause ACQ_REL is not allowed if clause WRITE appears on the ATOMIC directive
295 !$omp atomic acq_rel write
297 !ERROR: Clause ACQ_REL is not allowed if clause WRITE appears on the ATOMIC directive
298 !$omp atomic write acq_rel
301 !ERROR: Clause ACQUIRE is not allowed if clause WRITE appears on the ATOMIC directive
302 !$omp atomic acquire write
304 !ERROR: Clause ACQUIRE is not allowed if clause WRITE appears on the ATOMIC directive
305 !$omp atomic write acquire
310 ! If atomic-clause is update or not present then memory-order-clause must not be acq_rel or acquire.
312 !ERROR: Clause ACQ_REL is not allowed if clause UPDATE appears on the ATOMIC directive
313 !$omp atomic acq_rel update
315 !ERROR: Clause ACQ_REL is not allowed if clause UPDATE appears on the ATOMIC directive
316 !$omp atomic update acq_rel
319 !ERROR: Clause ACQUIRE is not allowed if clause UPDATE appears on the ATOMIC directive
320 !$omp atomic acquire update
323 !ERROR: Clause ACQUIRE is not allowed if clause UPDATE appears on the ATOMIC directive
324 !$omp atomic update acquire
327 !ERROR: Clause ACQ_REL is not allowed on the ATOMIC directive
331 !ERROR: Clause ACQUIRE is not allowed on the ATOMIC directive