1 ! RUN: %python %S/test_errors.py %s %flang_fc1 -fopenmp
2 ! Semantic checks for OpenMP 5.0 standard 2.17.7 atomic Construct.
6 integer :: i
, j
= 10, k
=-100, a
8 ! Handled inside parser.
9 ! OpenMP constructs may not be encountered during execution of an atomic region
12 ! At most one memory-order-clause may appear on the construct.
15 !ERROR: More than one memory order clause not allowed on OpenMP Atomic 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: More than one memory order clause not allowed on OpenMP Atomic construct
20 !ERROR: At most one SEQ_CST clause can appear on the READ directive
21 !$omp atomic read seq_cst seq_cst
23 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
24 !ERROR: At most one SEQ_CST clause can appear on the READ directive
25 !$omp atomic seq_cst read seq_cst
28 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
29 !ERROR: At most one ACQUIRE clause can appear on the READ directive
30 !$omp atomic acquire acquire read
32 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
33 !ERROR: At most one ACQUIRE clause can appear on the READ directive
34 !$omp atomic read acquire acquire
36 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
37 !ERROR: At most one ACQUIRE clause can appear on the READ directive
38 !$omp atomic acquire read acquire
41 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
42 !ERROR: At most one RELAXED clause can appear on the READ directive
43 !$omp atomic relaxed relaxed read
45 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
46 !ERROR: At most one RELAXED clause can appear on the READ directive
47 !$omp atomic read relaxed relaxed
49 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
50 !ERROR: At most one RELAXED clause can appear on the READ directive
51 !$omp atomic relaxed read relaxed
55 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
56 !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
57 !$omp atomic seq_cst seq_cst update
59 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
60 !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
61 !$omp atomic update seq_cst seq_cst
63 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
64 !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
65 !$omp atomic seq_cst update seq_cst
68 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
69 !ERROR: At most one RELEASE clause can appear on the UPDATE directive
70 !$omp atomic release release update
72 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
73 !ERROR: At most one RELEASE clause can appear on the UPDATE directive
74 !$omp atomic update release release
76 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
77 !ERROR: At most one RELEASE clause can appear on the UPDATE directive
78 !$omp atomic release update release
81 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
82 !ERROR: At most one RELAXED clause can appear on the UPDATE directive
83 !$omp atomic relaxed relaxed update
85 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
86 !ERROR: At most one RELAXED clause can appear on the UPDATE directive
87 !$omp atomic update relaxed relaxed
89 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
90 !ERROR: At most one RELAXED clause can appear on the UPDATE directive
91 !$omp atomic relaxed update relaxed
95 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
96 !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
97 !$omp atomic seq_cst seq_cst capture
101 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
102 !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
103 !$omp atomic capture seq_cst seq_cst
108 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
109 !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
110 !$omp atomic seq_cst capture seq_cst
115 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
116 !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
117 !$omp atomic release release capture
122 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
123 !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
124 !$omp atomic capture release release
129 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
130 !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
131 !$omp atomic release capture release
136 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
137 !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
138 !$omp atomic relaxed relaxed capture
143 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
144 !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
145 !$omp atomic capture relaxed relaxed
150 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
151 !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
152 !$omp atomic relaxed capture relaxed
157 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
158 !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
159 !$omp atomic acq_rel acq_rel capture
164 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
165 !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
166 !$omp atomic capture acq_rel acq_rel
171 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
172 !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
173 !$omp atomic acq_rel capture acq_rel
178 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
179 !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
180 !$omp atomic acquire acquire capture
185 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
186 !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
187 !$omp atomic capture acquire acquire
192 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
193 !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
194 !$omp atomic acquire capture acquire
200 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
201 !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
202 !$omp atomic seq_cst seq_cst write
204 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
205 !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
206 !$omp atomic write seq_cst seq_cst
209 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
210 !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
211 !$omp atomic seq_cst write seq_cst
214 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
215 !ERROR: At most one RELEASE clause can appear on the WRITE directive
216 !$omp atomic release release write
218 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
219 !ERROR: At most one RELEASE clause can appear on the WRITE directive
220 !$omp atomic write release release
222 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
223 !ERROR: At most one RELEASE clause can appear on the WRITE directive
224 !$omp atomic release write release
226 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
227 !ERROR: At most one RELAXED clause can appear on the WRITE directive
228 !$omp atomic relaxed relaxed write
230 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
231 !ERROR: At most one RELAXED clause can appear on the WRITE directive
232 !$omp atomic write relaxed relaxed
234 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
235 !ERROR: At most one RELAXED clause can appear on the WRITE directive
236 !$omp atomic relaxed write relaxed
240 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
241 !ERROR: At most one RELAXED clause can appear on the ATOMIC directive
242 !$omp atomic relaxed relaxed
244 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
245 !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive
246 !$omp atomic seq_cst seq_cst
248 !ERROR: More than one memory order clause not allowed on OpenMP Atomic construct
249 !ERROR: At most one RELEASE clause can appear on the ATOMIC directive
250 !$omp atomic release release
254 ! At most one hint clause may appear on the construct.
256 !ERROR: At most one HINT clause can appear on the READ directive
257 !$omp atomic hint(omp_sync_hint_speculative) hint(omp_sync_hint_speculative) read
259 !ERROR: At most one HINT clause can appear on the READ directive
260 !$omp atomic hint(omp_sync_hint_nonspeculative) read hint(omp_sync_hint_nonspeculative)
262 !ERROR: At most one HINT clause can appear on the READ directive
263 !$omp atomic read hint(omp_sync_hint_uncontended) hint (omp_sync_hint_uncontended)
265 !ERROR: At most one HINT clause can appear on the WRITE directive
266 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write
268 !ERROR: At most one HINT clause can appear on the WRITE directive
269 !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)
271 !ERROR: At most one HINT clause can appear on the WRITE directive
272 !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
274 !ERROR: At most one HINT clause can appear on the WRITE directive
275 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write
277 !ERROR: At most one HINT clause can appear on the WRITE directive
278 !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)
280 !ERROR: At most one HINT clause can appear on the WRITE directive
281 !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
283 !ERROR: At most one HINT clause can appear on the UPDATE directive
284 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) update
286 !ERROR: At most one HINT clause can appear on the UPDATE directive
287 !$omp atomic hint(omp_sync_hint_nonspeculative) update hint(omp_sync_hint_nonspeculative)
289 !ERROR: At most one HINT clause can appear on the UPDATE directive
290 !$omp atomic update hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
292 !ERROR: At most one HINT clause can appear on the ATOMIC directive
293 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative)
295 !ERROR: At most one HINT clause can appear on the ATOMIC directive
296 !$omp atomic hint(omp_sync_hint_none) hint(omp_sync_hint_nonspeculative)
298 !ERROR: At most one HINT clause can appear on the ATOMIC directive
299 !$omp atomic hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
302 !ERROR: At most one HINT clause can appear on the CAPTURE directive
303 !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) capture
307 !ERROR: At most one HINT clause can appear on the CAPTURE directive
308 !$omp atomic hint(omp_sync_hint_nonspeculative) capture hint(omp_sync_hint_nonspeculative)
312 !ERROR: At most one HINT clause can appear on the CAPTURE directive
313 !$omp atomic capture hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
318 ! If atomic-clause is read then memory-order-clause must not be acq_rel or release.
320 !ERROR: Clause ACQ_REL is not allowed if clause READ appears on the ATOMIC directive
321 !$omp atomic acq_rel read
323 !ERROR: Clause ACQ_REL is not allowed if clause READ appears on the ATOMIC directive
324 !$omp atomic read acq_rel
327 !ERROR: Clause RELEASE is not allowed if clause READ appears on the ATOMIC directive
328 !$omp atomic release read
330 !ERROR: Clause RELEASE is not allowed if clause READ appears on the ATOMIC directive
331 !$omp atomic read release
335 ! If atomic-clause is write then memory-order-clause must not be acq_rel or acquire.
337 !ERROR: Clause ACQ_REL is not allowed if clause WRITE appears on the ATOMIC directive
338 !$omp atomic acq_rel write
340 !ERROR: Clause ACQ_REL is not allowed if clause WRITE appears on the ATOMIC directive
341 !$omp atomic write acq_rel
344 !ERROR: Clause ACQUIRE is not allowed if clause WRITE appears on the ATOMIC directive
345 !$omp atomic acquire write
347 !ERROR: Clause ACQUIRE is not allowed if clause WRITE appears on the ATOMIC directive
348 !$omp atomic write acquire
353 ! If atomic-clause is update or not present then memory-order-clause must not be acq_rel or acquire.
355 !ERROR: Clause ACQ_REL is not allowed if clause UPDATE appears on the ATOMIC directive
356 !$omp atomic acq_rel update
358 !ERROR: Clause ACQ_REL is not allowed if clause UPDATE appears on the ATOMIC directive
359 !$omp atomic update acq_rel
362 !ERROR: Clause ACQUIRE is not allowed if clause UPDATE appears on the ATOMIC directive
363 !$omp atomic acquire update
366 !ERROR: Clause ACQUIRE is not allowed if clause UPDATE appears on the ATOMIC directive
367 !$omp atomic update acquire
370 !ERROR: Clause ACQ_REL is not allowed on the ATOMIC directive
374 !ERROR: Clause ACQUIRE is not allowed on the ATOMIC directive