xref: /aosp_15_r20/external/clang/test/OpenMP/atomic_messages.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2*67e74705SXin Li 
foo()3*67e74705SXin Li int foo() {
4*67e74705SXin Li L1:
5*67e74705SXin Li   foo();
6*67e74705SXin Li #pragma omp atomic
7*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
8*67e74705SXin Li   // expected-note@+1 {{expected an expression statement}}
9*67e74705SXin Li   {
10*67e74705SXin Li     foo();
11*67e74705SXin Li     goto L1; // expected-error {{use of undeclared label 'L1'}}
12*67e74705SXin Li   }
13*67e74705SXin Li   goto L2; // expected-error {{use of undeclared label 'L2'}}
14*67e74705SXin Li #pragma omp atomic
15*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
16*67e74705SXin Li   // expected-note@+1 {{expected an expression statement}}
17*67e74705SXin Li   {
18*67e74705SXin Li     foo();
19*67e74705SXin Li   L2:
20*67e74705SXin Li     foo();
21*67e74705SXin Li   }
22*67e74705SXin Li 
23*67e74705SXin Li   return 0;
24*67e74705SXin Li }
25*67e74705SXin Li 
26*67e74705SXin Li struct S {
27*67e74705SXin Li   int a;
28*67e74705SXin Li };
29*67e74705SXin Li 
readint()30*67e74705SXin Li int readint() {
31*67e74705SXin Li   int a = 0, b = 0;
32*67e74705SXin Li // Test for atomic read
33*67e74705SXin Li #pragma omp atomic read
34*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
35*67e74705SXin Li   // expected-note@+1 {{expected an expression statement}}
36*67e74705SXin Li   ;
37*67e74705SXin Li #pragma omp atomic read
38*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
39*67e74705SXin Li   // expected-note@+1 {{expected built-in assignment operator}}
40*67e74705SXin Li   foo();
41*67e74705SXin Li #pragma omp atomic read
42*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
43*67e74705SXin Li   // expected-note@+1 {{expected built-in assignment operator}}
44*67e74705SXin Li   a += b;
45*67e74705SXin Li #pragma omp atomic read
46*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
47*67e74705SXin Li   // expected-note@+1 {{expected lvalue expression}}
48*67e74705SXin Li   a = 0;
49*67e74705SXin Li #pragma omp atomic read
50*67e74705SXin Li   a = b;
51*67e74705SXin Li   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
52*67e74705SXin Li #pragma omp atomic read read
53*67e74705SXin Li   a = b;
54*67e74705SXin Li 
55*67e74705SXin Li   return 0;
56*67e74705SXin Li }
57*67e74705SXin Li 
readS()58*67e74705SXin Li int readS() {
59*67e74705SXin Li   struct S a, b;
60*67e74705SXin Li   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}}
61*67e74705SXin Li #pragma omp atomic read read
62*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}}
63*67e74705SXin Li   // expected-note@+1 {{expected expression of scalar type}}
64*67e74705SXin Li   a = b;
65*67e74705SXin Li 
66*67e74705SXin Li   return a.a;
67*67e74705SXin Li }
68*67e74705SXin Li 
writeint()69*67e74705SXin Li int writeint() {
70*67e74705SXin Li   int a = 0, b = 0;
71*67e74705SXin Li // Test for atomic write
72*67e74705SXin Li #pragma omp atomic write
73*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
74*67e74705SXin Li   // expected-note@+1 {{expected an expression statement}}
75*67e74705SXin Li   ;
76*67e74705SXin Li #pragma omp atomic write
77*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
78*67e74705SXin Li   // expected-note@+1 {{expected built-in assignment operator}}
79*67e74705SXin Li   foo();
80*67e74705SXin Li #pragma omp atomic write
81*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
82*67e74705SXin Li   // expected-note@+1 {{expected built-in assignment operator}}
83*67e74705SXin Li   a += b;
84*67e74705SXin Li #pragma omp atomic write
85*67e74705SXin Li   a = 0;
86*67e74705SXin Li #pragma omp atomic write
87*67e74705SXin Li   a = b;
88*67e74705SXin Li   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}}
89*67e74705SXin Li #pragma omp atomic write write
90*67e74705SXin Li   a = b;
91*67e74705SXin Li 
92*67e74705SXin Li   return 0;
93*67e74705SXin Li }
94*67e74705SXin Li 
writeS()95*67e74705SXin Li int writeS() {
96*67e74705SXin Li   struct S a, b;
97*67e74705SXin Li   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}}
98*67e74705SXin Li #pragma omp atomic write write
99*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic write' must be an expression statement of form 'x = expr;', where x is a lvalue expression with scalar type}}
100*67e74705SXin Li   // expected-note@+1 {{expected expression of scalar type}}
101*67e74705SXin Li   a = b;
102*67e74705SXin Li 
103*67e74705SXin Li   return a.a;
104*67e74705SXin Li }
105*67e74705SXin Li 
updateint()106*67e74705SXin Li int updateint() {
107*67e74705SXin Li   int a = 0, b = 0;
108*67e74705SXin Li // Test for atomic update
109*67e74705SXin Li #pragma omp atomic update
110*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
111*67e74705SXin Li   // expected-note@+1 {{expected an expression statement}}
112*67e74705SXin Li   ;
113*67e74705SXin Li #pragma omp atomic
114*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
115*67e74705SXin Li   // expected-note@+1 {{expected built-in binary or unary operator}}
116*67e74705SXin Li   foo();
117*67e74705SXin Li #pragma omp atomic
118*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
119*67e74705SXin Li   // expected-note@+1 {{expected built-in binary operator}}
120*67e74705SXin Li   a = b;
121*67e74705SXin Li #pragma omp atomic update
122*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
123*67e74705SXin Li   // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
124*67e74705SXin Li   a = b || a;
125*67e74705SXin Li #pragma omp atomic update
126*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
127*67e74705SXin Li   // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
128*67e74705SXin Li   a = a && b;
129*67e74705SXin Li #pragma omp atomic update
130*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic update' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
131*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of expression}}
132*67e74705SXin Li   a = (float)a + b;
133*67e74705SXin Li #pragma omp atomic
134*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
135*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of expression}}
136*67e74705SXin Li   a = 2 * b;
137*67e74705SXin Li #pragma omp atomic
138*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
139*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of expression}}
140*67e74705SXin Li   a = b + *&a;
141*67e74705SXin Li #pragma omp atomic update
142*67e74705SXin Li   *&a = *&a +  2;
143*67e74705SXin Li #pragma omp atomic update
144*67e74705SXin Li   a++;
145*67e74705SXin Li #pragma omp atomic
146*67e74705SXin Li   ++a;
147*67e74705SXin Li #pragma omp atomic update
148*67e74705SXin Li   a--;
149*67e74705SXin Li #pragma omp atomic
150*67e74705SXin Li   --a;
151*67e74705SXin Li #pragma omp atomic update
152*67e74705SXin Li   a += b;
153*67e74705SXin Li #pragma omp atomic
154*67e74705SXin Li   a %= b;
155*67e74705SXin Li #pragma omp atomic update
156*67e74705SXin Li   a *= b;
157*67e74705SXin Li #pragma omp atomic
158*67e74705SXin Li   a -= b;
159*67e74705SXin Li #pragma omp atomic update
160*67e74705SXin Li   a /= b;
161*67e74705SXin Li #pragma omp atomic
162*67e74705SXin Li   a &= b;
163*67e74705SXin Li #pragma omp atomic update
164*67e74705SXin Li   a ^= b;
165*67e74705SXin Li #pragma omp atomic
166*67e74705SXin Li   a |= b;
167*67e74705SXin Li #pragma omp atomic update
168*67e74705SXin Li   a <<= b;
169*67e74705SXin Li #pragma omp atomic
170*67e74705SXin Li   a >>= b;
171*67e74705SXin Li #pragma omp atomic update
172*67e74705SXin Li   a = b + a;
173*67e74705SXin Li #pragma omp atomic
174*67e74705SXin Li   a = a * b;
175*67e74705SXin Li #pragma omp atomic update
176*67e74705SXin Li   a = b - a;
177*67e74705SXin Li #pragma omp atomic
178*67e74705SXin Li   a = a / b;
179*67e74705SXin Li #pragma omp atomic update
180*67e74705SXin Li   a = b & a;
181*67e74705SXin Li #pragma omp atomic
182*67e74705SXin Li   a = a ^ b;
183*67e74705SXin Li #pragma omp atomic update
184*67e74705SXin Li   a = b | a;
185*67e74705SXin Li #pragma omp atomic
186*67e74705SXin Li   a = a << b;
187*67e74705SXin Li #pragma omp atomic
188*67e74705SXin Li   a = b >> a;
189*67e74705SXin Li   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}}
190*67e74705SXin Li #pragma omp atomic update update
191*67e74705SXin Li   a /= b;
192*67e74705SXin Li 
193*67e74705SXin Li   return 0;
194*67e74705SXin Li }
195*67e74705SXin Li 
captureint()196*67e74705SXin Li int captureint() {
197*67e74705SXin Li   int a = 0, b = 0, c = 0;
198*67e74705SXin Li // Test for atomic capture
199*67e74705SXin Li #pragma omp atomic capture
200*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
201*67e74705SXin Li   // expected-note@+1 {{expected compound statement}}
202*67e74705SXin Li   ;
203*67e74705SXin Li #pragma omp atomic capture
204*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
205*67e74705SXin Li   // expected-note@+1 {{expected assignment expression}}
206*67e74705SXin Li   foo();
207*67e74705SXin Li #pragma omp atomic capture
208*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
209*67e74705SXin Li   // expected-note@+1 {{expected built-in binary or unary operator}}
210*67e74705SXin Li   a = b;
211*67e74705SXin Li #pragma omp atomic capture
212*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
213*67e74705SXin Li   // expected-note@+1 {{expected assignment expression}}
214*67e74705SXin Li   a = b || a;
215*67e74705SXin Li #pragma omp atomic capture
216*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
217*67e74705SXin Li   // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}}
218*67e74705SXin Li   b = a = a && b;
219*67e74705SXin Li #pragma omp atomic capture
220*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
221*67e74705SXin Li   // expected-note@+1 {{expected assignment expression}}
222*67e74705SXin Li   a = (float)a + b;
223*67e74705SXin Li #pragma omp atomic capture
224*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
225*67e74705SXin Li   // expected-note@+1 {{expected assignment expression}}
226*67e74705SXin Li   a = 2 * b;
227*67e74705SXin Li #pragma omp atomic capture
228*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
229*67e74705SXin Li   // expected-note@+1 {{expected assignment expression}}
230*67e74705SXin Li   a = b + *&a;
231*67e74705SXin Li #pragma omp atomic capture
232*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
233*67e74705SXin Li   // expected-note@+1 {{expected exactly two expression statements}}
234*67e74705SXin Li   { a = b; }
235*67e74705SXin Li #pragma omp atomic capture
236*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
237*67e74705SXin Li   // expected-note@+1 {{expected exactly two expression statements}}
238*67e74705SXin Li   {}
239*67e74705SXin Li #pragma omp atomic capture
240*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
241*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of the first expression}}
242*67e74705SXin Li   {a = b;a = b;}
243*67e74705SXin Li #pragma omp atomic capture
244*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}', '{v = x; x = x binop expr;}', '{v = x; x = expr binop x;}', '{x = x binop expr; v = x;}', '{x = expr binop x; v = x;}' or '{v = x; x = expr;}', '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}' where x is an l-value expression with scalar type}}
245*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of the first expression}}
246*67e74705SXin Li   {a = b; a = b || a;}
247*67e74705SXin Li #pragma omp atomic capture
248*67e74705SXin Li   {b = a; a = a && b;}
249*67e74705SXin Li #pragma omp atomic capture
250*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
251*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of expression}}
252*67e74705SXin Li   b = a = (float)a + b;
253*67e74705SXin Li #pragma omp atomic capture
254*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
255*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of expression}}
256*67e74705SXin Li   b = a = 2 * b;
257*67e74705SXin Li #pragma omp atomic capture
258*67e74705SXin Li   // expected-error@+2 {{the statement for 'atomic capture' must be an expression statement of form 'v = ++x;', 'v = --x;', 'v = x++;', 'v = x--;', 'v = x binop= expr;', 'v = x = x binop expr' or 'v = x = expr binop x', where x and v are both l-value expressions with scalar type}}
259*67e74705SXin Li   // expected-note@+1 {{expected in right hand side of expression}}
260*67e74705SXin Li   b = a = b + *&a;
261*67e74705SXin Li #pragma omp atomic capture
262*67e74705SXin Li   c = *&a = *&a +  2;
263*67e74705SXin Li #pragma omp atomic capture
264*67e74705SXin Li   c = a++;
265*67e74705SXin Li #pragma omp atomic capture
266*67e74705SXin Li   c = ++a;
267*67e74705SXin Li #pragma omp atomic capture
268*67e74705SXin Li   c = a--;
269*67e74705SXin Li #pragma omp atomic capture
270*67e74705SXin Li   c = --a;
271*67e74705SXin Li #pragma omp atomic capture
272*67e74705SXin Li   c = a += b;
273*67e74705SXin Li #pragma omp atomic capture
274*67e74705SXin Li   c = a %= b;
275*67e74705SXin Li #pragma omp atomic capture
276*67e74705SXin Li   c = a *= b;
277*67e74705SXin Li #pragma omp atomic capture
278*67e74705SXin Li   c = a -= b;
279*67e74705SXin Li #pragma omp atomic capture
280*67e74705SXin Li   c = a /= b;
281*67e74705SXin Li #pragma omp atomic capture
282*67e74705SXin Li   c = a &= b;
283*67e74705SXin Li #pragma omp atomic capture
284*67e74705SXin Li   c = a ^= b;
285*67e74705SXin Li #pragma omp atomic capture
286*67e74705SXin Li   c = a |= b;
287*67e74705SXin Li #pragma omp atomic capture
288*67e74705SXin Li   c = a <<= b;
289*67e74705SXin Li #pragma omp atomic capture
290*67e74705SXin Li   c = a >>= b;
291*67e74705SXin Li #pragma omp atomic capture
292*67e74705SXin Li   c = a = b + a;
293*67e74705SXin Li #pragma omp atomic capture
294*67e74705SXin Li   c = a = a * b;
295*67e74705SXin Li #pragma omp atomic capture
296*67e74705SXin Li   c = a = b - a;
297*67e74705SXin Li #pragma omp atomic capture
298*67e74705SXin Li   c = a = a / b;
299*67e74705SXin Li #pragma omp atomic capture
300*67e74705SXin Li   c = a = b & a;
301*67e74705SXin Li #pragma omp atomic capture
302*67e74705SXin Li   c = a = a ^ b;
303*67e74705SXin Li #pragma omp atomic capture
304*67e74705SXin Li   c = a = b | a;
305*67e74705SXin Li #pragma omp atomic capture
306*67e74705SXin Li   c = a = a << b;
307*67e74705SXin Li #pragma omp atomic capture
308*67e74705SXin Li   c = a = b >> a;
309*67e74705SXin Li #pragma omp atomic capture
310*67e74705SXin Li   { c = *&a; *&a = *&a +  2;}
311*67e74705SXin Li #pragma omp atomic capture
312*67e74705SXin Li   { *&a = *&a +  2; c = *&a;}
313*67e74705SXin Li #pragma omp atomic capture
314*67e74705SXin Li   {c = a; a++;}
315*67e74705SXin Li #pragma omp atomic capture
316*67e74705SXin Li   {++a;c = a;}
317*67e74705SXin Li #pragma omp atomic capture
318*67e74705SXin Li   {c = a;a--;}
319*67e74705SXin Li #pragma omp atomic capture
320*67e74705SXin Li   {--a;c = a;}
321*67e74705SXin Li #pragma omp atomic capture
322*67e74705SXin Li   {c = a; a += b;}
323*67e74705SXin Li #pragma omp atomic capture
324*67e74705SXin Li   {a %= b; c = a;}
325*67e74705SXin Li #pragma omp atomic capture
326*67e74705SXin Li   {c = a; a *= b;}
327*67e74705SXin Li #pragma omp atomic capture
328*67e74705SXin Li   {a -= b;c = a;}
329*67e74705SXin Li #pragma omp atomic capture
330*67e74705SXin Li   {c = a; a /= b;}
331*67e74705SXin Li #pragma omp atomic capture
332*67e74705SXin Li   {a &= b; c = a;}
333*67e74705SXin Li #pragma omp atomic capture
334*67e74705SXin Li   {c = a; a ^= b;}
335*67e74705SXin Li #pragma omp atomic capture
336*67e74705SXin Li   {a |= b; c = a;}
337*67e74705SXin Li #pragma omp atomic capture
338*67e74705SXin Li   {c = a; a <<= b;}
339*67e74705SXin Li #pragma omp atomic capture
340*67e74705SXin Li   {a >>= b; c = a;}
341*67e74705SXin Li #pragma omp atomic capture
342*67e74705SXin Li   {c = a; a = b + a;}
343*67e74705SXin Li #pragma omp atomic capture
344*67e74705SXin Li   {a = a * b; c = a;}
345*67e74705SXin Li #pragma omp atomic capture
346*67e74705SXin Li   {c = a; a = b - a;}
347*67e74705SXin Li #pragma omp atomic capture
348*67e74705SXin Li   {a = a / b; c = a;}
349*67e74705SXin Li #pragma omp atomic capture
350*67e74705SXin Li   {c = a; a = b & a;}
351*67e74705SXin Li #pragma omp atomic capture
352*67e74705SXin Li   {a = a ^ b; c = a;}
353*67e74705SXin Li #pragma omp atomic capture
354*67e74705SXin Li   {c = a; a = b | a;}
355*67e74705SXin Li #pragma omp atomic capture
356*67e74705SXin Li   {a = a << b; c = a;}
357*67e74705SXin Li #pragma omp atomic capture
358*67e74705SXin Li   {c = a; a = b >> a;}
359*67e74705SXin Li #pragma omp atomic capture
360*67e74705SXin Li   {c = a; a = foo();}
361*67e74705SXin Li   // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}}
362*67e74705SXin Li #pragma omp atomic capture capture
363*67e74705SXin Li   b = a /= b;
364*67e74705SXin Li 
365*67e74705SXin Li   return 0;
366*67e74705SXin Li }
367*67e74705SXin Li 
368