| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s |
| 2 | |
| 3 | int foo() { |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 4 | L1: |
| 5 | foo(); |
| 6 | #pragma omp atomic |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 7 | // 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 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 9 | { |
| 10 | foo(); |
| 11 | goto L1; // expected-error {{use of undeclared label 'L1'}} |
| 12 | } |
| 13 | goto L2; // expected-error {{use of undeclared label 'L2'}} |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 14 | #pragma omp atomic |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 15 | // 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 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 17 | { |
| 18 | foo(); |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 19 | L2: |
| Alexey Bataev | 0162e45 | 2014-07-22 10:10:35 +0000 | [diff] [blame] | 20 | foo(); |
| 21 | } |
| 22 | |
| 23 | return 0; |
| 24 | } |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 25 | |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 26 | struct S { |
| 27 | int a; |
| 28 | S &operator=(int v) { |
| 29 | a = v; |
| 30 | return *this; |
| 31 | } |
| 32 | S &operator+=(const S &s) { |
| 33 | a += s.a; |
| 34 | return *this; |
| 35 | } |
| 36 | }; |
| 37 | |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 38 | template <class T> |
| 39 | T read() { |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 40 | T a = T(), b = T(); |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 41 | // Test for atomic read |
| 42 | #pragma omp atomic read |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 43 | // 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}} |
| 44 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 45 | ; |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 46 | #pragma omp atomic read |
| 47 | // 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}} |
| 48 | // expected-note@+1 {{expected built-in assignment operator}} |
| 49 | foo(); |
| 50 | #pragma omp atomic read |
| 51 | // 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}} |
| 52 | // expected-note@+1 {{expected built-in assignment operator}} |
| 53 | a += b; |
| 54 | #pragma omp atomic read |
| 55 | // 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}} |
| 56 | // expected-note@+1 {{expected lvalue expression}} |
| 57 | a = 0; |
| 58 | #pragma omp atomic read |
| 59 | // 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}} |
| 60 | // expected-note@+1 {{expected built-in assignment operator}} |
| 61 | a = b; |
| 62 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 63 | #pragma omp atomic read read |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 64 | // 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}} |
| 65 | // expected-note@+1 {{expected built-in assignment operator}} |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 66 | a = b; |
| 67 | |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 68 | return a; |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | int read() { |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 72 | int a = 0, b = 0; |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 73 | // Test for atomic read |
| 74 | #pragma omp atomic read |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 75 | // 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}} |
| 76 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 77 | ; |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 78 | #pragma omp atomic read |
| 79 | // 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}} |
| 80 | // expected-note@+1 {{expected built-in assignment operator}} |
| 81 | foo(); |
| 82 | #pragma omp atomic read |
| 83 | // 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}} |
| 84 | // expected-note@+1 {{expected built-in assignment operator}} |
| 85 | a += b; |
| 86 | #pragma omp atomic read |
| 87 | // 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}} |
| 88 | // expected-note@+1 {{expected lvalue expression}} |
| 89 | a = 0; |
| 90 | #pragma omp atomic read |
| 91 | a = b; |
| 92 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 93 | #pragma omp atomic read read |
| 94 | a = b; |
| 95 | |
| Alexey Bataev | 62cec44 | 2014-11-18 10:14:22 +0000 | [diff] [blame] | 96 | // expected-note@+1 {{in instantiation of function template specialization 'read<S>' requested here}} |
| 97 | return read<int>() + read<S>().a; |
| Alexey Bataev | f98b00c | 2014-07-23 02:27:21 +0000 | [diff] [blame] | 98 | } |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 99 | |
| 100 | template <class T> |
| 101 | T write() { |
| 102 | T a, b = 0; |
| 103 | // Test for atomic write |
| 104 | #pragma omp atomic write |
| Alexey Bataev | f33eba6 | 2014-11-28 07:21:40 +0000 | [diff] [blame] | 105 | // 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}} |
| 106 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 107 | ; |
| 108 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}} |
| 109 | #pragma omp atomic write write |
| 110 | a = b; |
| Alexey Bataev | f33eba6 | 2014-11-28 07:21:40 +0000 | [diff] [blame] | 111 | #pragma omp atomic write |
| 112 | // 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}} |
| 113 | // expected-note@+1 {{expected built-in assignment operator}} |
| 114 | foo(); |
| 115 | #pragma omp atomic write |
| 116 | // 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}} |
| 117 | // expected-note@+1 {{expected built-in assignment operator}} |
| 118 | a += b; |
| 119 | #pragma omp atomic write |
| 120 | a = 0; |
| 121 | #pragma omp atomic write |
| 122 | a = b; |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 123 | |
| 124 | return T(); |
| 125 | } |
| 126 | |
| 127 | int write() { |
| 128 | int a, b = 0; |
| 129 | // Test for atomic write |
| 130 | #pragma omp atomic write |
| Alexey Bataev | f33eba6 | 2014-11-28 07:21:40 +0000 | [diff] [blame] | 131 | // 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}} |
| 132 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 133 | ; |
| 134 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'write' clause}} |
| 135 | #pragma omp atomic write write |
| 136 | a = b; |
| Alexey Bataev | f33eba6 | 2014-11-28 07:21:40 +0000 | [diff] [blame] | 137 | #pragma omp atomic write |
| 138 | // 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}} |
| 139 | // expected-note@+1 {{expected built-in assignment operator}} |
| 140 | foo(); |
| 141 | #pragma omp atomic write |
| 142 | // 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}} |
| 143 | // expected-note@+1 {{expected built-in assignment operator}} |
| 144 | a += b; |
| 145 | #pragma omp atomic write |
| 146 | a = 0; |
| 147 | #pragma omp atomic write |
| 148 | a = foo(); |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 149 | |
| 150 | return write<int>(); |
| 151 | } |
| 152 | |
| 153 | template <class T> |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 154 | T update() { |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 155 | T a = 0, b = 0, c = 0; |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 156 | // Test for atomic update |
| 157 | #pragma omp atomic update |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 158 | // 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}} |
| 159 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 160 | ; |
| 161 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}} |
| 162 | #pragma omp atomic update update |
| 163 | a += b; |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 164 | #pragma omp atomic |
| 165 | // 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}} |
| 166 | // expected-note@+1 {{expected built-in binary operator}} |
| 167 | a = b; |
| 168 | #pragma omp atomic update |
| 169 | // 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}} |
| 170 | // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}} |
| 171 | a = b || a; |
| 172 | #pragma omp atomic update |
| 173 | // 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}} |
| 174 | // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}} |
| 175 | a = a && b; |
| 176 | #pragma omp atomic update |
| 177 | // 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}} |
| 178 | // expected-note@+1 {{expected in right hand side of expression}} |
| 179 | a = float(a) + b; |
| 180 | #pragma omp atomic |
| 181 | // 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}} |
| 182 | // expected-note@+1 {{expected in right hand side of expression}} |
| 183 | a = 2 * b; |
| 184 | #pragma omp atomic |
| 185 | // 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}} |
| 186 | // expected-note@+1 {{expected in right hand side of expression}} |
| 187 | a = b + *&a; |
| 188 | #pragma omp atomic |
| 189 | *&a = b * *&a; |
| 190 | #pragma omp atomic update |
| 191 | a++; |
| 192 | #pragma omp atomic |
| 193 | ++a; |
| 194 | #pragma omp atomic update |
| 195 | a--; |
| 196 | #pragma omp atomic |
| 197 | --a; |
| 198 | #pragma omp atomic update |
| 199 | a += b; |
| 200 | #pragma omp atomic |
| 201 | a %= b; |
| 202 | #pragma omp atomic update |
| 203 | a *= b; |
| 204 | #pragma omp atomic |
| 205 | a -= b; |
| 206 | #pragma omp atomic update |
| 207 | a /= b; |
| 208 | #pragma omp atomic |
| 209 | a &= b; |
| 210 | #pragma omp atomic update |
| 211 | a ^= b; |
| 212 | #pragma omp atomic |
| 213 | a |= b; |
| 214 | #pragma omp atomic update |
| 215 | a <<= b; |
| 216 | #pragma omp atomic |
| 217 | a >>= b; |
| 218 | #pragma omp atomic update |
| 219 | a = b + a; |
| 220 | #pragma omp atomic |
| 221 | a = a * b; |
| 222 | #pragma omp atomic update |
| 223 | a = b - a; |
| 224 | #pragma omp atomic |
| 225 | a = a / b; |
| 226 | #pragma omp atomic update |
| 227 | a = b & a; |
| 228 | #pragma omp atomic |
| 229 | a = a ^ b; |
| 230 | #pragma omp atomic update |
| 231 | a = b | a; |
| 232 | #pragma omp atomic |
| 233 | a = a << b; |
| 234 | #pragma omp atomic |
| 235 | a = b >> a; |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 236 | |
| 237 | #pragma omp atomic |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 238 | // 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}} |
| 239 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 240 | ; |
| 241 | |
| 242 | return T(); |
| 243 | } |
| 244 | |
| 245 | int update() { |
| 246 | int a, b = 0; |
| 247 | // Test for atomic update |
| 248 | #pragma omp atomic update |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 249 | // 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}} |
| 250 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 251 | ; |
| 252 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'update' clause}} |
| 253 | #pragma omp atomic update update |
| 254 | a += b; |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 255 | #pragma omp atomic |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 256 | // 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}} |
| 257 | // expected-note@+1 {{expected built-in binary operator}} |
| 258 | a = b; |
| 259 | #pragma omp atomic update |
| 260 | // 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}} |
| 261 | // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}} |
| 262 | a = b || a; |
| 263 | #pragma omp atomic update |
| 264 | // 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}} |
| 265 | // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}} |
| 266 | a = a && b; |
| 267 | #pragma omp atomic update |
| 268 | // 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}} |
| 269 | // expected-note@+1 {{expected in right hand side of expression}} |
| 270 | a = float(a) + b; |
| 271 | #pragma omp atomic |
| 272 | // 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}} |
| 273 | // expected-note@+1 {{expected in right hand side of expression}} |
| 274 | a = 2 * b; |
| 275 | #pragma omp atomic |
| 276 | // 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}} |
| 277 | // expected-note@+1 {{expected in right hand side of expression}} |
| 278 | a = b + *&a; |
| 279 | #pragma omp atomic update |
| 280 | a++; |
| 281 | #pragma omp atomic |
| 282 | ++a; |
| 283 | #pragma omp atomic update |
| 284 | a--; |
| 285 | #pragma omp atomic |
| 286 | --a; |
| 287 | #pragma omp atomic update |
| 288 | a += b; |
| 289 | #pragma omp atomic |
| 290 | a %= b; |
| 291 | #pragma omp atomic update |
| 292 | a *= b; |
| 293 | #pragma omp atomic |
| 294 | a -= b; |
| 295 | #pragma omp atomic update |
| 296 | a /= b; |
| 297 | #pragma omp atomic |
| 298 | a &= b; |
| 299 | #pragma omp atomic update |
| 300 | a ^= b; |
| 301 | #pragma omp atomic |
| 302 | a |= b; |
| 303 | #pragma omp atomic update |
| 304 | a <<= b; |
| 305 | #pragma omp atomic |
| 306 | a >>= b; |
| 307 | #pragma omp atomic update |
| 308 | a = b + a; |
| 309 | #pragma omp atomic |
| 310 | a = a * b; |
| 311 | #pragma omp atomic update |
| 312 | a = b - a; |
| 313 | #pragma omp atomic |
| 314 | a = a / b; |
| 315 | #pragma omp atomic update |
| 316 | a = b & a; |
| 317 | #pragma omp atomic |
| 318 | a = a ^ b; |
| 319 | #pragma omp atomic update |
| 320 | a = b | a; |
| 321 | #pragma omp atomic |
| 322 | a = a << b; |
| 323 | #pragma omp atomic |
| 324 | a = b >> a; |
| 325 | #pragma omp atomic |
| 326 | // 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}} |
| 327 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 328 | ; |
| 329 | |
| 330 | return update<int>(); |
| 331 | } |
| 332 | |
| 333 | template <class T> |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 334 | T capture() { |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 335 | T a = 0, b = 0, c = 0; |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 336 | // Test for atomic capture |
| 337 | #pragma omp atomic capture |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 338 | // 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}} |
| 339 | // expected-note@+1 {{expected compound statement}} |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 340 | ; |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 341 | #pragma omp atomic capture |
| 342 | // 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}} |
| 343 | // expected-note@+1 {{expected assignment expression}} |
| 344 | foo(); |
| 345 | #pragma omp atomic capture |
| 346 | // 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}} |
| 347 | // expected-note@+1 {{expected built-in binary or unary operator}} |
| 348 | a = b; |
| 349 | #pragma omp atomic capture |
| 350 | // 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}} |
| 351 | // expected-note@+1 {{expected assignment expression}} |
| 352 | a = b || a; |
| 353 | #pragma omp atomic capture |
| 354 | // 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}} |
| 355 | // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}} |
| 356 | b = a = a && b; |
| 357 | #pragma omp atomic capture |
| 358 | // 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}} |
| 359 | // expected-note@+1 {{expected assignment expression}} |
| 360 | a = (float)a + b; |
| 361 | #pragma omp atomic capture |
| 362 | // 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}} |
| 363 | // expected-note@+1 {{expected assignment expression}} |
| 364 | a = 2 * b; |
| 365 | #pragma omp atomic capture |
| 366 | // 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}} |
| 367 | // expected-note@+1 {{expected assignment expression}} |
| 368 | a = b + *&a; |
| 369 | #pragma omp atomic capture |
| 370 | // 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}} |
| 371 | // expected-note@+1 {{expected exactly two expression statements}} |
| 372 | { a = b; } |
| 373 | #pragma omp atomic capture |
| 374 | // 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}} |
| 375 | // expected-note@+1 {{expected exactly two expression statements}} |
| 376 | {} |
| 377 | #pragma omp atomic capture |
| 378 | // 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}} |
| 379 | // expected-note@+1 {{expected in right hand side of the first expression}} |
| 380 | {a = b;a = b;} |
| 381 | #pragma omp atomic capture |
| 382 | // 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}} |
| 383 | // expected-note@+1 {{expected in right hand side of the first expression}} |
| 384 | {a = b; a = b || a;} |
| 385 | #pragma omp atomic capture |
| 386 | {b = a; a = a && b;} |
| 387 | #pragma omp atomic capture |
| 388 | // 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}} |
| 389 | // expected-note@+1 {{expected in right hand side of expression}} |
| 390 | b = a = (float)a + b; |
| 391 | #pragma omp atomic capture |
| 392 | // 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}} |
| 393 | // expected-note@+1 {{expected in right hand side of expression}} |
| 394 | b = a = 2 * b; |
| 395 | #pragma omp atomic capture |
| 396 | // 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}} |
| 397 | // expected-note@+1 {{expected in right hand side of expression}} |
| 398 | b = a = b + *&a; |
| 399 | #pragma omp atomic capture |
| 400 | c = *&a = *&a + 2; |
| 401 | #pragma omp atomic capture |
| 402 | c = a++; |
| 403 | #pragma omp atomic capture |
| 404 | c = ++a; |
| 405 | #pragma omp atomic capture |
| 406 | c = a--; |
| 407 | #pragma omp atomic capture |
| 408 | c = --a; |
| 409 | #pragma omp atomic capture |
| 410 | c = a += b; |
| 411 | #pragma omp atomic capture |
| 412 | c = a %= b; |
| 413 | #pragma omp atomic capture |
| 414 | c = a *= b; |
| 415 | #pragma omp atomic capture |
| 416 | c = a -= b; |
| 417 | #pragma omp atomic capture |
| 418 | c = a /= b; |
| 419 | #pragma omp atomic capture |
| 420 | c = a &= b; |
| 421 | #pragma omp atomic capture |
| 422 | c = a ^= b; |
| 423 | #pragma omp atomic capture |
| 424 | c = a |= b; |
| 425 | #pragma omp atomic capture |
| 426 | c = a <<= b; |
| 427 | #pragma omp atomic capture |
| 428 | c = a >>= b; |
| 429 | #pragma omp atomic capture |
| 430 | c = a = b + a; |
| 431 | #pragma omp atomic capture |
| 432 | c = a = a * b; |
| 433 | #pragma omp atomic capture |
| 434 | c = a = b - a; |
| 435 | #pragma omp atomic capture |
| 436 | c = a = a / b; |
| 437 | #pragma omp atomic capture |
| 438 | c = a = b & a; |
| 439 | #pragma omp atomic capture |
| 440 | c = a = a ^ b; |
| 441 | #pragma omp atomic capture |
| 442 | c = a = b | a; |
| 443 | #pragma omp atomic capture |
| 444 | c = a = a << b; |
| 445 | #pragma omp atomic capture |
| 446 | c = a = b >> a; |
| 447 | #pragma omp atomic capture |
| 448 | { c = *&a; *&a = *&a + 2;} |
| 449 | #pragma omp atomic capture |
| 450 | { *&a = *&a + 2; c = *&a;} |
| 451 | #pragma omp atomic capture |
| 452 | {c = a; a++;} |
| 453 | #pragma omp atomic capture |
| 454 | {++a;c = a;} |
| 455 | #pragma omp atomic capture |
| 456 | {c = a;a--;} |
| 457 | #pragma omp atomic capture |
| 458 | {--a;c = a;} |
| 459 | #pragma omp atomic capture |
| 460 | {c = a; a += b;} |
| 461 | #pragma omp atomic capture |
| 462 | {a %= b; c = a;} |
| 463 | #pragma omp atomic capture |
| 464 | {c = a; a *= b;} |
| 465 | #pragma omp atomic capture |
| 466 | {a -= b;c = a;} |
| 467 | #pragma omp atomic capture |
| 468 | {c = a; a /= b;} |
| 469 | #pragma omp atomic capture |
| 470 | {a &= b; c = a;} |
| 471 | #pragma omp atomic capture |
| 472 | {c = a; a ^= b;} |
| 473 | #pragma omp atomic capture |
| 474 | {a |= b; c = a;} |
| 475 | #pragma omp atomic capture |
| 476 | {c = a; a <<= b;} |
| 477 | #pragma omp atomic capture |
| 478 | {a >>= b; c = a;} |
| 479 | #pragma omp atomic capture |
| 480 | {c = a; a = b + a;} |
| 481 | #pragma omp atomic capture |
| 482 | {a = a * b; c = a;} |
| 483 | #pragma omp atomic capture |
| 484 | {c = a; a = b - a;} |
| 485 | #pragma omp atomic capture |
| 486 | {a = a / b; c = a;} |
| 487 | #pragma omp atomic capture |
| 488 | {c = a; a = b & a;} |
| 489 | #pragma omp atomic capture |
| 490 | {a = a ^ b; c = a;} |
| 491 | #pragma omp atomic capture |
| 492 | {c = a; a = b | a;} |
| 493 | #pragma omp atomic capture |
| 494 | {a = a << b; c = a;} |
| 495 | #pragma omp atomic capture |
| 496 | {c = a; a = b >> a;} |
| 497 | #pragma omp atomic capture |
| 498 | {c = a; a = foo();} |
| 499 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}} |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 500 | #pragma omp atomic capture capture |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 501 | b = a /= b; |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 502 | |
| 503 | return T(); |
| 504 | } |
| 505 | |
| 506 | int capture() { |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 507 | int a = 0, b = 0, c = 0; |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 508 | // Test for atomic capture |
| 509 | #pragma omp atomic capture |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 510 | // 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}} |
| 511 | // expected-note@+1 {{expected compound statement}} |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 512 | ; |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 513 | #pragma omp atomic capture |
| 514 | // 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}} |
| 515 | // expected-note@+1 {{expected assignment expression}} |
| 516 | foo(); |
| 517 | #pragma omp atomic capture |
| 518 | // 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}} |
| 519 | // expected-note@+1 {{expected built-in binary or unary operator}} |
| 520 | a = b; |
| 521 | #pragma omp atomic capture |
| 522 | // 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}} |
| 523 | // expected-note@+1 {{expected assignment expression}} |
| 524 | a = b || a; |
| 525 | #pragma omp atomic capture |
| 526 | // 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}} |
| 527 | // expected-note@+1 {{expected one of '+', '*', '-', '/', '&', '^', '|', '<<', or '>>' built-in operations}} |
| 528 | b = a = a && b; |
| 529 | #pragma omp atomic capture |
| 530 | // 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}} |
| 531 | // expected-note@+1 {{expected assignment expression}} |
| 532 | a = (float)a + b; |
| 533 | #pragma omp atomic capture |
| 534 | // 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}} |
| 535 | // expected-note@+1 {{expected assignment expression}} |
| 536 | a = 2 * b; |
| 537 | #pragma omp atomic capture |
| 538 | // 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}} |
| 539 | // expected-note@+1 {{expected assignment expression}} |
| 540 | a = b + *&a; |
| 541 | #pragma omp atomic capture |
| 542 | // 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}} |
| 543 | // expected-note@+1 {{expected exactly two expression statements}} |
| 544 | { a = b; } |
| 545 | #pragma omp atomic capture |
| 546 | // 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}} |
| 547 | // expected-note@+1 {{expected exactly two expression statements}} |
| 548 | {} |
| 549 | #pragma omp atomic capture |
| 550 | // 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}} |
| 551 | // expected-note@+1 {{expected in right hand side of the first expression}} |
| 552 | {a = b;a = b;} |
| 553 | #pragma omp atomic capture |
| 554 | // 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}} |
| 555 | // expected-note@+1 {{expected in right hand side of the first expression}} |
| 556 | {a = b; a = b || a;} |
| 557 | #pragma omp atomic capture |
| 558 | {b = a; a = a && b;} |
| 559 | #pragma omp atomic capture |
| 560 | // 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}} |
| 561 | // expected-note@+1 {{expected in right hand side of expression}} |
| 562 | b = a = (float)a + b; |
| 563 | #pragma omp atomic capture |
| 564 | // 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}} |
| 565 | // expected-note@+1 {{expected in right hand side of expression}} |
| 566 | b = a = 2 * b; |
| 567 | #pragma omp atomic capture |
| 568 | // 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}} |
| 569 | // expected-note@+1 {{expected in right hand side of expression}} |
| 570 | b = a = b + *&a; |
| 571 | #pragma omp atomic capture |
| 572 | c = *&a = *&a + 2; |
| 573 | #pragma omp atomic capture |
| 574 | c = a++; |
| 575 | #pragma omp atomic capture |
| 576 | c = ++a; |
| 577 | #pragma omp atomic capture |
| 578 | c = a--; |
| 579 | #pragma omp atomic capture |
| 580 | c = --a; |
| 581 | #pragma omp atomic capture |
| 582 | c = a += b; |
| 583 | #pragma omp atomic capture |
| 584 | c = a %= b; |
| 585 | #pragma omp atomic capture |
| 586 | c = a *= b; |
| 587 | #pragma omp atomic capture |
| 588 | c = a -= b; |
| 589 | #pragma omp atomic capture |
| 590 | c = a /= b; |
| 591 | #pragma omp atomic capture |
| 592 | c = a &= b; |
| 593 | #pragma omp atomic capture |
| 594 | c = a ^= b; |
| 595 | #pragma omp atomic capture |
| 596 | c = a |= b; |
| 597 | #pragma omp atomic capture |
| 598 | c = a <<= b; |
| 599 | #pragma omp atomic capture |
| 600 | c = a >>= b; |
| 601 | #pragma omp atomic capture |
| 602 | c = a = b + a; |
| 603 | #pragma omp atomic capture |
| 604 | c = a = a * b; |
| 605 | #pragma omp atomic capture |
| 606 | c = a = b - a; |
| 607 | #pragma omp atomic capture |
| 608 | c = a = a / b; |
| 609 | #pragma omp atomic capture |
| 610 | c = a = b & a; |
| 611 | #pragma omp atomic capture |
| 612 | c = a = a ^ b; |
| 613 | #pragma omp atomic capture |
| 614 | c = a = b | a; |
| 615 | #pragma omp atomic capture |
| 616 | c = a = a << b; |
| 617 | #pragma omp atomic capture |
| 618 | c = a = b >> a; |
| 619 | #pragma omp atomic capture |
| 620 | { c = *&a; *&a = *&a + 2;} |
| 621 | #pragma omp atomic capture |
| 622 | { *&a = *&a + 2; c = *&a;} |
| 623 | #pragma omp atomic capture |
| 624 | {c = a; a++;} |
| 625 | #pragma omp atomic capture |
| 626 | {++a;c = a;} |
| 627 | #pragma omp atomic capture |
| 628 | {c = a;a--;} |
| 629 | #pragma omp atomic capture |
| 630 | {--a;c = a;} |
| 631 | #pragma omp atomic capture |
| 632 | {c = a; a += b;} |
| 633 | #pragma omp atomic capture |
| 634 | {a %= b; c = a;} |
| 635 | #pragma omp atomic capture |
| 636 | {c = a; a *= b;} |
| 637 | #pragma omp atomic capture |
| 638 | {a -= b;c = a;} |
| 639 | #pragma omp atomic capture |
| 640 | {c = a; a /= b;} |
| 641 | #pragma omp atomic capture |
| 642 | {a &= b; c = a;} |
| 643 | #pragma omp atomic capture |
| 644 | {c = a; a ^= b;} |
| 645 | #pragma omp atomic capture |
| 646 | {a |= b; c = a;} |
| 647 | #pragma omp atomic capture |
| 648 | {c = a; a <<= b;} |
| 649 | #pragma omp atomic capture |
| 650 | {a >>= b; c = a;} |
| 651 | #pragma omp atomic capture |
| 652 | {c = a; a = b + a;} |
| 653 | #pragma omp atomic capture |
| 654 | {a = a * b; c = a;} |
| 655 | #pragma omp atomic capture |
| 656 | {c = a; a = b - a;} |
| 657 | #pragma omp atomic capture |
| 658 | {a = a / b; c = a;} |
| 659 | #pragma omp atomic capture |
| 660 | {c = a; a = b & a;} |
| 661 | #pragma omp atomic capture |
| 662 | {a = a ^ b; c = a;} |
| 663 | #pragma omp atomic capture |
| 664 | {c = a; a = b | a;} |
| 665 | #pragma omp atomic capture |
| 666 | {a = a << b; c = a;} |
| 667 | #pragma omp atomic capture |
| 668 | {c = a; a = b >> a;} |
| 669 | #pragma omp atomic capture |
| 670 | {c = a; a = foo();} |
| 671 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'capture' clause}} |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 672 | #pragma omp atomic capture capture |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 673 | b = a /= b; |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 674 | |
| Alexey Bataev | b78ca83 | 2015-04-01 03:33:17 +0000 | [diff] [blame^] | 675 | // expected-note@+1 {{in instantiation of function template specialization 'capture<int>' requested here}} |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 676 | return capture<int>(); |
| 677 | } |
| 678 | |
| 679 | template <class T> |
| Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 680 | T seq_cst() { |
| 681 | T a, b = 0; |
| 682 | // Test for atomic seq_cst |
| 683 | #pragma omp atomic seq_cst |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 684 | // 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}} |
| 685 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 686 | ; |
| 687 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}} |
| 688 | #pragma omp atomic seq_cst seq_cst |
| 689 | a += b; |
| 690 | |
| 691 | #pragma omp atomic update seq_cst |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 692 | // 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}} |
| 693 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 694 | ; |
| 695 | |
| 696 | return T(); |
| 697 | } |
| 698 | |
| 699 | int seq_cst() { |
| 700 | int a, b = 0; |
| 701 | // Test for atomic seq_cst |
| 702 | #pragma omp atomic seq_cst |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 703 | // 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}} |
| 704 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 705 | ; |
| 706 | // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'seq_cst' clause}} |
| 707 | #pragma omp atomic seq_cst seq_cst |
| 708 | a += b; |
| 709 | |
| 710 | #pragma omp atomic update seq_cst |
| Alexey Bataev | 1d160b1 | 2015-03-13 12:27:31 +0000 | [diff] [blame] | 711 | // 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}} |
| 712 | // expected-note@+1 {{expected an expression statement}} |
| Alexey Bataev | 82bad8b | 2014-07-24 08:55:34 +0000 | [diff] [blame] | 713 | ; |
| 714 | |
| 715 | return seq_cst<int>(); |
| 716 | } |
| 717 | |
| 718 | template <class T> |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 719 | T mixed() { |
| 720 | T a, b = T(); |
| 721 | // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 722 | // expected-note@+1 2 {{'read' clause used here}} |
| 723 | #pragma omp atomic read write |
| 724 | a = b; |
| 725 | // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 726 | // expected-note@+1 2 {{'write' clause used here}} |
| 727 | #pragma omp atomic write read |
| 728 | a = b; |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 729 | // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 730 | // expected-note@+1 2 {{'update' clause used here}} |
| 731 | #pragma omp atomic update read |
| 732 | a += b; |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 733 | // expected-error@+2 2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 734 | // expected-note@+1 2 {{'capture' clause used here}} |
| 735 | #pragma omp atomic capture read |
| 736 | a = ++b; |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 737 | return T(); |
| 738 | } |
| 739 | |
| 740 | int mixed() { |
| 741 | int a, b = 0; |
| 742 | // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 743 | // expected-note@+1 {{'read' clause used here}} |
| 744 | #pragma omp atomic read write |
| 745 | a = b; |
| 746 | // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 747 | // expected-note@+1 {{'write' clause used here}} |
| 748 | #pragma omp atomic write read |
| 749 | a = b; |
| Alexey Bataev | 67a4f22 | 2014-07-23 10:25:33 +0000 | [diff] [blame] | 750 | // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 751 | // expected-note@+1 {{'write' clause used here}} |
| 752 | #pragma omp atomic write update |
| 753 | a = b; |
| Alexey Bataev | 459dec0 | 2014-07-24 06:46:57 +0000 | [diff] [blame] | 754 | // expected-error@+2 {{directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause}} |
| 755 | // expected-note@+1 {{'write' clause used here}} |
| 756 | #pragma omp atomic write capture |
| 757 | a = b; |
| 758 | // expected-note@+1 {{in instantiation of function template specialization 'mixed<int>' requested here}} |
| Alexey Bataev | dea4761 | 2014-07-23 07:46:59 +0000 | [diff] [blame] | 759 | return mixed<int>(); |
| 760 | } |
| 761 | |