aboutsummaryrefslogtreecommitdiff
blob: 298f9aec53c233ee9207732f25f3499605de2781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
! Semantic checks for OpenMP 5.0 standard 2.17.7 atomic Construct.

use omp_lib
  implicit none
  integer :: i, j = 10, k=-100, a
! 2.17.7.1
! Handled inside parser.
! OpenMP constructs may not be encountered during execution of an atomic region

! 2.17.7.2
! At most one memory-order-clause may appear on the construct.

!READ
  !ERROR: At most one SEQ_CST clause can appear on the READ directive
  !$omp atomic seq_cst seq_cst read
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the READ directive
  !$omp atomic read seq_cst seq_cst
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the READ directive
  !$omp atomic seq_cst read seq_cst
    i = j

  !ERROR: At most one ACQUIRE clause can appear on the READ directive
  !$omp atomic acquire acquire read
    i = j
  !ERROR: At most one ACQUIRE clause can appear on the READ directive
  !$omp atomic read acquire acquire
    i = j
  !ERROR: At most one ACQUIRE clause can appear on the READ directive
  !$omp atomic acquire read acquire
    i = j

  !ERROR: At most one RELAXED clause can appear on the READ directive
  !$omp atomic relaxed relaxed read
    i = j
  !ERROR: At most one RELAXED clause can appear on the READ directive
  !$omp atomic read relaxed relaxed
    i = j
  !ERROR: At most one RELAXED clause can appear on the READ directive
  !$omp atomic relaxed read relaxed
    i = j

!UPDATE
  !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
  !$omp atomic seq_cst seq_cst update
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
  !$omp atomic update seq_cst seq_cst
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the UPDATE directive
  !$omp atomic seq_cst update seq_cst
    i = j

  !ERROR: At most one RELEASE clause can appear on the UPDATE directive
  !$omp atomic release release update
    i = j
  !ERROR: At most one RELEASE clause can appear on the UPDATE directive
  !$omp atomic update release release
    i = j
  !ERROR: At most one RELEASE clause can appear on the UPDATE directive
  !$omp atomic release update release
    i = j

  !ERROR: At most one RELAXED clause can appear on the UPDATE directive
  !$omp atomic relaxed relaxed update
    i = j
  !ERROR: At most one RELAXED clause can appear on the UPDATE directive
  !$omp atomic update relaxed relaxed
    i = j
  !ERROR: At most one RELAXED clause can appear on the UPDATE directive
  !$omp atomic relaxed update relaxed
    i = j

!CAPTURE
  !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
  !$omp atomic seq_cst seq_cst capture
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
  !$omp atomic capture seq_cst seq_cst
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one SEQ_CST clause can appear on the CAPTURE directive
  !$omp atomic seq_cst capture seq_cst
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
  !$omp atomic release release capture
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
  !$omp atomic capture release release
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one RELEASE clause can appear on the CAPTURE directive
  !$omp atomic release capture release
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
  !$omp atomic relaxed relaxed capture
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
  !$omp atomic capture relaxed relaxed
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one RELAXED clause can appear on the CAPTURE directive
  !$omp atomic relaxed capture relaxed
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
  !$omp atomic acq_rel acq_rel capture
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
  !$omp atomic capture acq_rel acq_rel
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one ACQ_REL clause can appear on the CAPTURE directive
  !$omp atomic acq_rel capture acq_rel
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
  !$omp atomic acquire acquire capture
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
  !$omp atomic capture acquire acquire
    i = j
    j = k
  !$omp end atomic

  !ERROR: At most one ACQUIRE clause can appear on the CAPTURE directive
  !$omp atomic acquire capture acquire
    i = j
    j = k
  !$omp end atomic

!WRITE
  !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
  !$omp atomic seq_cst seq_cst write
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
  !$omp atomic write seq_cst seq_cst
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the WRITE directive
  !$omp atomic seq_cst write seq_cst
    i = j

  !ERROR: At most one RELEASE clause can appear on the WRITE directive
  !$omp atomic release release write
    i = j
  !ERROR: At most one RELEASE clause can appear on the WRITE directive
  !$omp atomic write release release
    i = j
  !ERROR: At most one RELEASE clause can appear on the WRITE directive
  !$omp atomic release write release
    i = j

  !ERROR: At most one RELAXED clause can appear on the WRITE directive
  !$omp atomic relaxed relaxed write
    i = j
  !ERROR: At most one RELAXED clause can appear on the WRITE directive
  !$omp atomic write relaxed relaxed
    i = j
  !ERROR: At most one RELAXED clause can appear on the WRITE directive
  !$omp atomic relaxed write relaxed
    i = j

!No atomic-clause
  !ERROR: At most one RELAXED clause can appear on the ATOMIC directive
  !$omp atomic relaxed relaxed
    i = j
  !ERROR: At most one SEQ_CST clause can appear on the ATOMIC directive
  !$omp atomic seq_cst seq_cst
    i = j
  !ERROR: At most one RELEASE clause can appear on the ATOMIC directive
  !$omp atomic release release
    i = j

! 2.17.7.3
! At most one hint clause may appear on the construct.

  !ERROR: At most one HINT clause can appear on the READ directive
  !$omp atomic hint(omp_sync_hint_speculative) hint(omp_sync_hint_speculative) read
    i = j
  !ERROR: At most one HINT clause can appear on the READ directive
  !$omp atomic hint(omp_sync_hint_nonspeculative) read hint(omp_sync_hint_nonspeculative)
    i = j
  !ERROR: At most one HINT clause can appear on the READ directive
  !$omp atomic read hint(omp_sync_hint_uncontended) hint (omp_sync_hint_uncontended)
    i = j
  !ERROR: At most one HINT clause can appear on the WRITE directive
  !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write
    i = j
  !ERROR: At most one HINT clause can appear on the WRITE directive
  !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)
    i = j
  !ERROR: At most one HINT clause can appear on the WRITE directive
  !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
    i = j
  !ERROR: At most one HINT clause can appear on the WRITE directive
  !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) write
    i = j
  !ERROR: At most one HINT clause can appear on the WRITE directive
  !$omp atomic hint(omp_sync_hint_nonspeculative) write hint(omp_sync_hint_nonspeculative)
    i = j
  !ERROR: At most one HINT clause can appear on the WRITE directive
  !$omp atomic write hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
    i = j
  !ERROR: At most one HINT clause can appear on the UPDATE directive
  !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) update
    i = j
  !ERROR: At most one HINT clause can appear on the UPDATE directive
  !$omp atomic hint(omp_sync_hint_nonspeculative) update hint(omp_sync_hint_nonspeculative)
    i = j
  !ERROR: At most one HINT clause can appear on the UPDATE directive
  !$omp atomic update hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
    i = j
  !ERROR: At most one HINT clause can appear on the ATOMIC directive
  !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative)
    i = j
  !ERROR: At most one HINT clause can appear on the ATOMIC directive
  !$omp atomic hint(omp_sync_hint_none) hint(omp_sync_hint_nonspeculative)
    i = j
  !ERROR: At most one HINT clause can appear on the ATOMIC directive
  !$omp atomic hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
    i = j

  !ERROR: At most one HINT clause can appear on the CAPTURE directive
  !$omp atomic hint(omp_sync_hint_contended) hint(omp_sync_hint_speculative) capture
    i = j
    j = k
  !$omp end atomic
  !ERROR: At most one HINT clause can appear on the CAPTURE directive
  !$omp atomic hint(omp_sync_hint_nonspeculative) capture hint(omp_sync_hint_nonspeculative)
    i = j
    j = k
  !$omp end atomic
  !ERROR: At most one HINT clause can appear on the CAPTURE directive
  !$omp atomic capture hint(omp_sync_hint_none) hint (omp_sync_hint_uncontended)
    i = j
    j = k
  !$omp end atomic
! 2.17.7.4
! If atomic-clause is read then memory-order-clause must not be acq_rel or release.

  !ERROR: Clause ACQ_REL is not allowed if clause READ appears on the ATOMIC directive
  !$omp atomic acq_rel read
    i = j
  !ERROR: Clause ACQ_REL is not allowed if clause READ appears on the ATOMIC directive
  !$omp atomic read acq_rel
    i = j

  !ERROR: Clause RELEASE is not allowed if clause READ appears on the ATOMIC directive
  !$omp atomic release read
    i = j
  !ERROR: Clause RELEASE is not allowed if clause READ appears on the ATOMIC directive
  !$omp atomic read release
    i = j

! 2.17.7.5
! If atomic-clause is write then memory-order-clause must not be acq_rel or acquire.

  !ERROR: Clause ACQ_REL is not allowed if clause WRITE appears on the ATOMIC directive
  !$omp atomic acq_rel write
    i = j
  !ERROR: Clause ACQ_REL is not allowed if clause WRITE appears on the ATOMIC directive
  !$omp atomic write acq_rel
    i = j

  !ERROR: Clause ACQUIRE is not allowed if clause WRITE appears on the ATOMIC directive
  !$omp atomic acquire write
    i = j
  !ERROR: Clause ACQUIRE is not allowed if clause WRITE appears on the ATOMIC directive
  !$omp atomic write acquire
    i = j


! 2.17.7.6
! If atomic-clause is update or not present then memory-order-clause must not be acq_rel or acquire.

  !ERROR: Clause ACQ_REL is not allowed if clause UPDATE appears on the ATOMIC directive
  !$omp atomic acq_rel update
    i = j
  !ERROR: Clause ACQ_REL is not allowed if clause UPDATE appears on the ATOMIC directive
  !$omp atomic update acq_rel
    i = j

  !ERROR: Clause ACQUIRE is not allowed if clause UPDATE appears on the ATOMIC directive
  !$omp atomic acquire update
    i = j

  !ERROR: Clause ACQUIRE is not allowed if clause UPDATE appears on the ATOMIC directive
  !$omp atomic update acquire
    i = j

  !ERROR: Clause ACQ_REL is not allowed on the ATOMIC directive
  !$omp atomic acq_rel
    i = j

  !ERROR: Clause ACQUIRE is not allowed on the ATOMIC directive
  !$omp atomic acquire
    i = j
end program