1884 lines · cpp
1// RUN: %clang_cc1 %s -fopenacc -Wno-unused-value -verify 2 3void NormalFunc(int I) {4 // No clauses are valid, but we parse them anyway, just mark them as not valid5 // on this construct.6 7 // expected-error@+1{{OpenACC 'copy' clause is not valid on 'atomic' directive}}8#pragma acc atomic copy(I)9 I = I + 1;10 // expected-error@+1{{OpenACC 'copy' clause is not valid on 'atomic' directive}}11#pragma acc atomic read copy(I)12 I = I;13}14 15struct Struct{16 Struct *getPtr();17 Struct &operator++();18 Struct &operator--();19 Struct &operator++(int);20 Struct &operator--(int);21 22 Struct &operator+=(int);23 Struct &operator*=(int);24 Struct &operator-=(int);25 Struct &operator/=(int);26 Struct &operator&=(int);27 Struct &operator|=(int);28 Struct &operator<<=(int);29 Struct &operator>>=(int);30 Struct &operator^=(int);31 Struct &operator%=(int);32 Struct &operator!=(int);33 Struct &operator+();34 Struct &operator-();35 36 operator int();37 void operator()();38 Struct &operator*();39 Struct &operator=(int);40};41 42int operator+(Struct&, int);43int operator+(int, Struct&);44Struct &operator+(Struct&, Struct&);45Struct &operator*(Struct&, Struct&);46Struct &operator-(Struct&, Struct&);47 48Struct S1, S2;49 50struct NotCondition{} NC;51 52template<typename T>53T &getRValue();54 55void IfClause(int x, int v) {56 // expected-error@+1{{OpenACC 'seq' clause is not valid on 'atomic' directive}}57#pragma acc atomic read seq58 x = v;59 60 // expected-error@+1{{expected '('}}61#pragma acc atomic read if62 x = v;63 64 // expected-error@+1{{value of type 'struct NotCondition' is not contextually convertible to 'bool'}}65#pragma acc atomic read if(NC)66 x = v;67 68 // expected-error@+2{{OpenACC 'if' clause cannot appear more than once on a 'atomic' directive}}69 // expected-note@+1{{previous 'if' clause is here}}70#pragma acc atomic read if(x) if (v)71 x = v;72}73 74template<typename T>75void AtomicReadTemplate(T LHS, T RHS) {76#pragma acc atomic read77 LHS = RHS;78 79 T *LHSPtr, *RHSPtr;80 81#pragma acc atomic read82 LHSPtr = RHSPtr;83 84 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}85 // expected-note@+2{{right operand to assignment expression must be an l-value}}86#pragma acc atomic read87 LHS = RHS + 1;88 89#pragma acc atomic read90 *LHSPtr = RHS;91 92#pragma acc atomic read93 LHS = *RHSPtr;94 95 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}96 // expected-note@+2{{right operand to assignment expression must be an l-value}}97#pragma acc atomic read98 LHS = getRValue<T>();99}100 101template<typename T>102void AtomicReadTemplate2(T LHS, T RHS) {103 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}104 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}105#pragma acc atomic read106 LHS = RHS;107 108 T *LHSPtr, *RHSPtr;109 // Fine, now a pointer.110#pragma acc atomic read111 LHSPtr = RHSPtr;112 113 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}114 // expected-note@+2{{right operand to assignment expression must be an l-value}}115#pragma acc atomic read116 LHS = *RHS.getPtr();117 118 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}119 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}120#pragma acc atomic read121 *LHSPtr = RHS;122 123 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}124 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}125#pragma acc atomic read126 LHS = *RHSPtr;127 128 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}129 // expected-note@+2{{left operand to assignment expression must be an l-value}}130#pragma acc atomic read131 getRValue<T>() = getRValue<T>();132 133 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}134 // expected-note@+2{{right operand to assignment expression must be an l-value}}135#pragma acc atomic read136 LHS = getRValue<T>();137}138 139void AtomicRead(int LHS, int RHS) {140 AtomicReadTemplate(LHS, RHS);141 AtomicReadTemplate2(S1, S2); // expected-note{{in instantiation of function template specialization}}142 143#pragma acc atomic read144 LHS = RHS;145 146 int *LHSPtr, *RHSPtr;147 148#pragma acc atomic read149 LHSPtr = RHSPtr;150 151 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}152 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}153#pragma acc atomic read154 S1 = S2;155 156 // expected-error@+2{{statement associated with OpenACC 'atomic read' directive is invalid}}157 // expected-note@+2{{right operand to assignment expression must be an l-value}}158#pragma acc atomic read159 LHS = RHS + 1;160 161#pragma acc atomic read162 *LHSPtr = RHS;163 164#pragma acc atomic read165 LHS = *RHSPtr;166 167 // There is no way to test that = is an overloaded operator, since there168 // really isn't a way to create an operator= without a class type on one side169 // or the other.170}171 172template<typename T>173void AtomicWriteTemplate(T LHS, T RHS) {174#pragma acc atomic write175 LHS = RHS;176 177 T *LHSPtr, *RHSPtr;178#pragma acc atomic write179 LHSPtr = RHSPtr;180 181#pragma acc atomic write182 *LHSPtr = *RHSPtr;183 184 // allowed, expr is ok.185#pragma acc atomic write186 LHS = *RHSPtr;187 188#pragma acc atomic write189 LHS = RHS * 2;190 191 // expected-error@+2{{statement associated with OpenACC 'atomic write' directive is invalid}}192 // expected-note@+2{{left operand to assignment expression must be an l-value}}193#pragma acc atomic write194 getRValue<T>() = getRValue<T>();195 196#pragma acc atomic write197 LHS = getRValue<T>();198}199 200template<typename T>201void AtomicWriteTemplate2(T LHS, T RHS) {202 // expected-error@+2{{statement associated with OpenACC 'atomic write' directive is invalid}}203 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}204#pragma acc atomic write205 LHS = RHS;206 207 T *LHSPtr, *RHSPtr;208#pragma acc atomic write209 LHSPtr = RHSPtr;210 211 // expected-error@+2{{statement associated with OpenACC 'atomic write' directive is invalid}}212 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}213#pragma acc atomic write214 LHS = *RHSPtr;215 216#pragma acc atomic write217 LHSPtr = RHS.getPtr();218 219 // expected-error@+2{{statement associated with OpenACC 'atomic write' directive is invalid}}220 // expected-note@+2{{left operand to assignment expression must be an l-value}}221#pragma acc atomic write222 getRValue<T>() = getRValue<T>();223 224 // expected-error@+2{{statement associated with OpenACC 'atomic write' directive is invalid}}225 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}226#pragma acc atomic write227 LHS = getRValue<T>();228}229 230void AtomicWrite(int LHS, int RHS) {231 AtomicWriteTemplate(LHS, RHS);232 AtomicWriteTemplate2(S1, S2); // expected-note{{in instantiation of function template specialization}}233 234#pragma acc atomic write235 LHS = RHS;236 237 int *LHSPtr, *RHSPtr;238#pragma acc atomic write239 LHSPtr = RHSPtr;240 241#pragma acc atomic write242 *LHSPtr = *RHSPtr;243 244 // allowed, expr is ok.245#pragma acc atomic write246 LHS = *RHSPtr;247 248#pragma acc atomic write249 LHS = RHS * 2;250}251 252template<typename T>253void AtomicUpdateTemplate(T LHS, T RHS) {254#pragma acc atomic255 LHS++;256 257#pragma acc atomic update258 LHS--;259 260#pragma acc atomic261 ++LHS;262 263#pragma acc atomic update264 --LHS;265 266 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}267 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}268#pragma acc atomic269 +LHS;270 271 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}272 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}273#pragma acc atomic update274 -LHS;275 276 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}277 // expected-note@+2{{expected binary operation on right hand side of assignment operator}}278#pragma acc atomic update279 LHS = RHS;280 281 T *LHSPtr, *RHSPtr;282 283 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}284 // expected-note@+2{{expected binary operation on right hand side of assignment operator}}285#pragma acc atomic286 *LHSPtr = *RHSPtr;287 288 // x binop= expr;289#pragma acc atomic290 LHS += 1 + RHS;291#pragma acc atomic update292 LHS *= 1 + RHS;293#pragma acc atomic294 LHS -= 1 + RHS;295#pragma acc atomic update296 LHS /= 1 + RHS;297#pragma acc atomic298 LHS &= 1 + RHS;299#pragma acc atomic update300 LHS ^= 1 + RHS;301#pragma acc atomic302 LHS |= 1 + RHS;303#pragma acc atomic update304 LHS <<= 1 + RHS;305#pragma acc atomic306 LHS >>= 1 + RHS;307 308 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}309 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}310#pragma acc atomic update311 LHS != 1 + RHS;312 313 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}314 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}315#pragma acc atomic update316 LHS <= 1 + RHS;317 318 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}319 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}320#pragma acc atomic update321 LHS >= 1 + RHS;322 323 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}324 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}325#pragma acc atomic update326 LHS %= 1 + RHS;327 328 // x = x binop expr.329#pragma acc atomic330 LHS = LHS + getRValue<T>();331#pragma acc atomic update332 LHS = LHS * getRValue<T>();333#pragma acc atomic update334 LHS = LHS - getRValue<T>();335#pragma acc atomic update336 LHS = LHS / getRValue<T>();337#pragma acc atomic update338 LHS = LHS & getRValue<T>();339#pragma acc atomic update340 LHS = LHS ^ getRValue<T>();341#pragma acc atomic update342 LHS = LHS | getRValue<T>();343#pragma acc atomic update344 LHS = LHS << getRValue<T>();345#pragma acc atomic update346 LHS = LHS >> getRValue<T>();347 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}348 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}349#pragma acc atomic update350 LHS = LHS < getRValue<T>();351 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}352 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}353#pragma acc atomic update354 LHS = LHS > getRValue<T>();355 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}356 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}357#pragma acc atomic update358 LHS = LHS <= getRValue<T>();359 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}360 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}361#pragma acc atomic update362 LHS = LHS >= getRValue<T>();363#pragma acc atomic update364 LHS = LHS ^ getRValue<T>();365 366 367 // x = expr binop x.368#pragma acc atomic369 LHS = getRValue<T>() + LHS;370#pragma acc atomic update371 LHS = getRValue<T>() * LHS;372#pragma acc atomic update373 LHS = getRValue<T>() - LHS;374#pragma acc atomic update375 LHS = getRValue<T>() / LHS;376#pragma acc atomic update377 LHS = getRValue<T>() & LHS;378#pragma acc atomic update379 LHS = getRValue<T>() ^ LHS;380#pragma acc atomic update381 LHS = getRValue<T>() | LHS;382#pragma acc atomic update383 LHS = getRValue<T>() << LHS;384#pragma acc atomic update385 LHS = getRValue<T>() >> LHS;386 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}387 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}388#pragma acc atomic update389 LHS = getRValue<T>() < LHS;390 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}391 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}392#pragma acc atomic update393 LHS = getRValue<T>() > LHS;394 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}395 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}396#pragma acc atomic update397 LHS = getRValue<T>() <= LHS;398 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}399 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}400#pragma acc atomic update401 LHS = getRValue<T>() >= LHS;402#pragma acc atomic update403 LHS = getRValue<T>() ^ LHS;404 405#pragma acc atomic update406 LHS = LHS + getRValue<T>();407 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}408 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and 'getRValue<T>()')}}409#pragma acc atomic update410 LHS = RHS + getRValue<T>();411 412#pragma acc atomic update413 LHS = getRValue<T>() - LHS;414 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}415 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('getRValue<T>()' and 'RHS')}}416#pragma acc atomic update417 LHS = getRValue<T>() + RHS;418}419 420template<typename T>421void AtomicUpdateTemplate2(T LHS, T RHS) {422 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}423 // expected-note@+2{{operand to increment expression must be of scalar type (was 'Struct')}}424#pragma acc atomic425 LHS++;426 427 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}428 // expected-note@+2{{operand to decrement expression must be of scalar type (was 'Struct')}}429#pragma acc atomic update430 LHS--;431 432 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}433 // expected-note@+2{{operand to increment expression must be of scalar type (was 'Struct')}}434#pragma acc atomic435 ++LHS;436 437 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}438 // expected-note@+2{{operand to decrement expression must be of scalar type (was 'Struct')}}439#pragma acc atomic update440 --LHS;441 442 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}443 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}444#pragma acc atomic445 +LHS;446 447 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}448 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}449#pragma acc atomic update450 -LHS;451 452 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}453 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}454#pragma acc atomic455 LHS();456 457 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}458 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}459#pragma acc atomic460 *LHS;461 462 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}463 // expected-note@+2{{expected binary operation on right hand side of assignment operator}}464#pragma acc atomic update465 LHS = RHS;466 467 T *LHSPtr, *RHSPtr;468 469 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}470 // expected-note@+2{{expected binary operation on right hand side of assignment operator}}471#pragma acc atomic472 *LHSPtr = *RHSPtr;473 474 // x binop= expr;475 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}476 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}477#pragma acc atomic478 LHS += 1 + RHS;479 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}480 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}481#pragma acc atomic update482 LHS *= 1 + RHS;483 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}484 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}485#pragma acc atomic486 LHS -= 1 + RHS;487 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}488 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}489#pragma acc atomic update490 LHS /= 1 + RHS;491 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}492 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}493#pragma acc atomic494 LHS &= 1 + RHS;495 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}496 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}497#pragma acc atomic update498 LHS ^= 1 + RHS;499 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}500 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}501#pragma acc atomic502 LHS |= 1 + RHS;503 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}504 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}505#pragma acc atomic update506 LHS <<= 1 + RHS;507 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}508 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}509#pragma acc atomic510 LHS >>= 1 + RHS;511 512 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}513 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}514#pragma acc atomic update515 LHS != 1 + RHS;516 517 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}518 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}519#pragma acc atomic update520 LHS %= 1 + RHS;521 522 // x = x binop expr.523 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}524 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}525#pragma acc atomic526 LHS = LHS + getRValue<T>();527 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}528 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}529#pragma acc atomic update530 LHS = LHS * getRValue<T>();531 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}532 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}533#pragma acc atomic update534 LHS = LHS - getRValue<T>();535 536 // x = expr binop x.537 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}538 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}539#pragma acc atomic540 LHS = getRValue<T>() + LHS;541 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}542 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}543#pragma acc atomic update544 LHS = getRValue<T>() * LHS;545 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}546 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}547#pragma acc atomic update548 LHS = getRValue<T>() - LHS;549 550 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}551 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}552#pragma acc atomic update553 LHS = LHS + getRValue<T>();554 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}555 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and 'getRValue<T>()')}}556#pragma acc atomic update557 LHS = RHS + getRValue<T>();558 559 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}560 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}561#pragma acc atomic update562 LHS = getRValue<T>() - LHS;563 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}564 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('getRValue<T>()' and 'RHS')}}565#pragma acc atomic update566 LHS = getRValue<T>() + RHS;567}568 569void AtomicUpdate() {570 AtomicUpdateTemplate(1, 2);571 AtomicUpdateTemplate2(S1, S2); //expected-note{{in instantiation of function template specialization}}572 573 int I, J;574 575#pragma acc atomic576 I++;577#pragma acc atomic update578 --I;579 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}580 // expected-note@+2{{operand to increment expression must be of scalar type (was 'Struct')}}581#pragma acc atomic582 S1++;583 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}584 // expected-note@+2{{operand to decrement expression must be of scalar type (was 'Struct')}}585#pragma acc atomic update586 --S2;587 588 // expected-error@+2{{statement associated with OpenACC 'atomic' directive is invalid}}589 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}590#pragma acc atomic591 +I;592 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}593 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}594#pragma acc atomic update595 -J;596 597#pragma acc atomic update598 I ^= 1 + J;599 600 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}601 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}602#pragma acc atomic update603 I%= 1 + J;604 605 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}606 // expected-note@+2{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}607#pragma acc atomic update608 S1 ^= 1 + J;609 610 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}611 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}612#pragma acc atomic update613 S2 %= 1 + J;614 615#pragma acc atomic update616 I = I + getRValue<int>();617 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}618 // expected-note@+2{{left hand side of assignment operation('I') must match one side of the sub-operation on the right hand side('J' and 'getRValue<int>()')}}619#pragma acc atomic update620 I = J + getRValue<int>();621 622#pragma acc atomic update623 I = getRValue<int>() - I;624 // expected-error@+2{{statement associated with OpenACC 'atomic update' directive is invalid}}625 // expected-note@+2{{left hand side of assignment operation('I') must match one side of the sub-operation on the right hand side('getRValue<int>()' and 'J')}}626#pragma acc atomic update627 I = getRValue<int>() + J;628}629 630template<typename T>631void AtomicCaptureTemplateSimple(T LHS, T RHS) {632 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}633 // expected-note@+2{{expected assignment expression}}634#pragma acc atomic capture635 LHS++;636 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}637 // expected-note@+2{{expected assignment expression}}638#pragma acc atomic capture639--LHS;640 641 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}642 // expected-note@+2{{expected assignment expression}}643#pragma acc atomic capture644 LHS += 1 + RHS;645 646 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}647 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}648#pragma acc atomic capture649 LHS = RHS;650 651#pragma acc atomic capture652 LHS = RHS++;653 654#pragma acc atomic capture655 LHS = RHS--;656 657#pragma acc atomic capture658 LHS = ++RHS;659 660#pragma acc atomic capture661 LHS = --RHS;662 663 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}664 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}665#pragma acc atomic capture666 LHS = +RHS;667 668#pragma acc atomic capture669 LHS = RHS += 1 + RHS;670#pragma acc atomic capture671 LHS = RHS *= 1 + RHS;672#pragma acc atomic capture673 LHS = RHS -= 1 + RHS;674#pragma acc atomic capture675 LHS = RHS /= 1 + RHS;676#pragma acc atomic capture677 LHS = RHS &= 1 + RHS;678#pragma acc atomic capture679 LHS = RHS ^= 1 + RHS;680#pragma acc atomic capture681 LHS = RHS >>= 1 + RHS;682#pragma acc atomic capture683 LHS = RHS |= 1 + RHS;684#pragma acc atomic capture685 LHS = RHS <<= 1 + RHS;686#pragma acc atomic capture687 LHS = RHS >>= 1 + RHS;688 689#pragma acc atomic capture690 LHS = RHS ^= 1 + RHS;691 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}692 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}693#pragma acc atomic capture694 LHS = RHS <= 1 + RHS;695 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}696 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}697#pragma acc atomic capture698 LHS = RHS >= 1 + RHS;699 700 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}701 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}702#pragma acc atomic capture703 LHS = RHS + 1;704 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}705 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}706#pragma acc atomic capture707 LHS = RHS < 1 + RHS;708 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}709 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}710#pragma acc atomic capture711 LHS = RHS > 1 + RHS;712 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}713 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}714#pragma acc atomic capture715 LHS = RHS ^ 1 + RHS;716 717#pragma acc atomic capture718 LHS = RHS = RHS + 1;719#pragma acc atomic capture720 LHS = RHS = 1 + RHS;721#pragma acc atomic capture722 LHS = RHS = RHS * 1;723#pragma acc atomic capture724 LHS = RHS = 1 * RHS;725#pragma acc atomic capture726 LHS = RHS = RHS / 1;727#pragma acc atomic capture728 LHS = RHS = 1 / RHS;729#pragma acc atomic capture730 LHS = RHS = RHS ^ 1;731 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}732 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}733#pragma acc atomic capture734 LHS = RHS = 1 % RHS;735 736 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}737 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}738#pragma acc atomic capture739 LHS = RHS = RHS < 1;740 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}741 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}742#pragma acc atomic capture743 LHS = RHS = 1 > RHS;744 745 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}746 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and 'getRValue<T>()')}}747#pragma acc atomic capture748 LHS = LHS = RHS + getRValue<T>();749 750 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}751 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('getRValue<T>()' and 'RHS')}}752#pragma acc atomic capture753 LHS = LHS = getRValue<T>() + RHS;754}755template<typename T>756void AtomicCaptureTemplateSimple2(T LHS, T RHS) {757 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}758 // expected-note@+2{{expected assignment expression}}759#pragma acc atomic capture760 LHS++;761 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}762 // expected-note@+2{{expected assignment expression}}763#pragma acc atomic capture764--LHS;765 766 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}767 // expected-note@+2{{expected assignment expression}}768#pragma acc atomic capture769 LHS += 1 + RHS;770 771 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}772 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}773#pragma acc atomic capture774 LHS = RHS;775 776 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}777 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}778#pragma acc atomic capture779 LHS = RHS++;780 781 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}782 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}783#pragma acc atomic capture784 LHS = RHS--;785 786 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}787 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}788#pragma acc atomic capture789 LHS = ++RHS;790 791 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}792 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}793#pragma acc atomic capture794 LHS = --RHS;795 796 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}797 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}798#pragma acc atomic capture799 LHS = +RHS;800 801 802 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}803 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}804#pragma acc atomic capture805 LHS = RHS += 1 + RHS;806 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}807 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}808#pragma acc atomic capture809 LHS = RHS *= 1 + RHS;810 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}811 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}812#pragma acc atomic capture813 LHS = RHS -= 1 + RHS;814 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}815 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}816#pragma acc atomic capture817 LHS = RHS /= 1 + RHS;818 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}819 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}820#pragma acc atomic capture821 LHS = RHS &= 1 + RHS;822 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}823 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}824#pragma acc atomic capture825 LHS = RHS ^= 1 + RHS;826 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}827 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}828#pragma acc atomic capture829 LHS = RHS >>= 1 + RHS;830 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}831 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}832#pragma acc atomic capture833 LHS = RHS |= 1 + RHS;834 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}835 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}836#pragma acc atomic capture837 LHS = RHS <<= 1 + RHS;838 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}839 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}840#pragma acc atomic capture841 LHS = RHS >>= 1 + RHS;842 843 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}844 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}845#pragma acc atomic capture846 LHS = RHS ^= 1 + RHS;847 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}848 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}849#pragma acc atomic capture850 LHS = RHS <= 1 + RHS;851 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}852 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}853#pragma acc atomic capture854 LHS = RHS >= 1 + RHS;855 856 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}857 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}858#pragma acc atomic capture859 LHS = RHS + 1;860 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}861 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}862#pragma acc atomic capture863 LHS = RHS < 1 + RHS;864 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}865 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}866#pragma acc atomic capture867 LHS = RHS > 1 + RHS;868 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}869 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}870#pragma acc atomic capture871 LHS = RHS ^ 1 + RHS;872 873 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}874 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}875#pragma acc atomic capture876 LHS = RHS = RHS + 1;877 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}878 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}879#pragma acc atomic capture880 LHS = RHS = 1 + RHS;881 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}882 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}883#pragma acc atomic capture884 LHS = RHS = RHS * 1;885 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}886 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}887#pragma acc atomic capture888 LHS = RHS = 1 * RHS;889 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}890 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}891#pragma acc atomic capture892 LHS = RHS = RHS / 1;893 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}894 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}895#pragma acc atomic capture896 LHS = RHS = 1 / RHS;897 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}898 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}899#pragma acc atomic capture900 LHS = RHS = RHS ^ 1;901 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}902 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}903#pragma acc atomic capture904 LHS = RHS = 1 % RHS;905 906 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}907 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}908#pragma acc atomic capture909 LHS = RHS = RHS < 1;910 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}911 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}912#pragma acc atomic capture913 LHS = RHS = 1 > RHS;914 915 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}916 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and 'getRValue<T>()')}}917#pragma acc atomic capture918 LHS = LHS = RHS + getRValue<T>();919 920 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}921 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('getRValue<T>()' and 'RHS')}}922#pragma acc atomic capture923 LHS = LHS = getRValue<T>() + RHS;924}925 926void AtomicCaptureSimple(int LHS, int RHS) {927 AtomicCaptureTemplateSimple(1, 2);928 AtomicCaptureTemplateSimple2(S1, S2); //expected-note{{in instantiation of function template specialization}}929 930 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}931 // expected-note@+2{{expected assignment expression}}932#pragma acc atomic capture933 LHS++;934 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}935 // expected-note@+2{{expected assignment expression}}936#pragma acc atomic capture937--LHS;938 939 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}940 // expected-note@+2{{expected assignment expression}}941#pragma acc atomic capture942 LHS += 1 + RHS;943 944 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}945 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}946#pragma acc atomic capture947 LHS = RHS;948 949#pragma acc atomic capture950 LHS = RHS++;951 952#pragma acc atomic capture953 LHS = RHS--;954 955 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}956 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}957#pragma acc atomic capture958 S1 = ++S2;959 960 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}961 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}962#pragma acc atomic capture963 S1 = --S2 ;964 965 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}966 // expected-note@+2{{unary operator not supported, only increment and decrement operations permitted}}967#pragma acc atomic capture968 LHS = +RHS;969 970#pragma acc atomic capture971 LHS = RHS += 1 + RHS;972#pragma acc atomic capture973 LHS = RHS *= 1 + RHS;974 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}975 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}976#pragma acc atomic capture977 S1 = RHS -= 1 + RHS;978 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}979 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}980#pragma acc atomic capture981 LHS = S1 /= 1 + RHS;982#pragma acc atomic capture983 LHS = RHS &= 1 + S2;984 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}985 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}986#pragma acc atomic capture987 LHS = S1^= 1 + S2;988 989#pragma acc atomic capture990 LHS = RHS ^= 1 + RHS;991 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}992 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}993#pragma acc atomic capture994 LHS = RHS <= 1 + RHS;995 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}996 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}997#pragma acc atomic capture998 S1 = RHS ^= 1 + RHS;999 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1000 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}1001#pragma acc atomic capture1002 LHS = S1 <= 1 + RHS;1003 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1004 // expected-note@+2{{compound binary operator not supported, only +=, *=, -=, /=, &=, ^=, |=, <<=, or >>= are permitted}}1005#pragma acc atomic capture1006 LHS = RHS <= 1 + S2;1007 1008#pragma acc atomic capture1009 LHS = RHS = RHS + 1;1010#pragma acc atomic capture1011 LHS = RHS = 1 + RHS;1012 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1013 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}1014#pragma acc atomic capture1015 S1 = RHS = RHS * 1;1016 // A little weird, because this contains a 'operator int' call here rather1017 // than a conversion, so the diagnostic could be better.1018 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1019 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}1020#pragma acc atomic capture1021 LHS = S2 = 1 * S2;1022 1023 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1024 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}1025#pragma acc atomic capture1026 LHS = RHS = RHS < 1;1027 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1028 // expected-note@+2{{binary operator not supported, only +, *, -, /, &, ^, |, <<, or >> are permitted}}1029#pragma acc atomic capture1030 LHS = RHS = 1 > RHS;1031 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1032 // expected-note@+2{{left operand to assignment expression must be of scalar type (was 'Struct')}}1033#pragma acc atomic capture1034 S1 = RHS = RHS < 1;1035 1036 // A little weird, because this contains a 'operator int' call here rather1037 // than a conversion, so the diagnostic could be better.1038 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1039 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}1040#pragma acc atomic capture1041 LHS = S1 = 1 > S1;1042 1043 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1044 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and 'getRValue<int>()')}}1045#pragma acc atomic capture1046 LHS = LHS = RHS + getRValue<int>();1047 1048 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1049 // expected-note@+2{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('getRValue<int>()' and 'RHS')}}1050#pragma acc atomic capture1051 LHS = LHS = getRValue<int>() + RHS;1052}1053 1054template<typename T>1055void AtomicCaptureTemplateCompound(T LHS, T RHS) {1056 1057 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1058 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}1059#pragma acc atomic capture1060 {1061 }1062 1063 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1064 // expected-note@+4{{expected assignment, compound assignment, increment, or decrement expression}}1065#pragma acc atomic capture1066 {1067 LHS = RHS;1068 }1069 1070 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1071 // expected-note@+3{{'atomic capture' with a compound statement only supports two statements}}1072#pragma acc atomic capture1073 {1074 LHS = RHS; RHS += 1; LHS=RHS;1075 }1076 1077 1078#pragma acc atomic capture1079 {1080 LHS++;1081 RHS = LHS;1082 }1083 1084#pragma acc atomic capture1085 {1086 ++LHS;1087 RHS = LHS;1088 }1089 1090#pragma acc atomic capture1091 {1092 --LHS;1093 RHS = LHS;1094 }1095 1096 1097#pragma acc atomic capture1098 {1099 LHS--;1100 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1101 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used in unary expression('LHS') from the first statement}}1102 LHS = RHS;1103 }1104 1105#pragma acc atomic capture1106 {1107 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1108 // expected-note@+1{{unary operator not supported, only increment and decrement operations permitted}}1109 -LHS;1110 RHS = LHS;1111 }1112 1113#pragma acc atomic capture1114 {1115 --LHS;1116 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1117 // expected-note@+1{{expected assignment expression}}1118 RHS += LHS;1119 }1120 1121 // { x binop = expr; v = x; }1122#pragma acc atomic capture1123 {1124 LHS += 1;1125 RHS = LHS;1126 }1127#pragma acc atomic capture1128 {1129 LHS *= 1;1130 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1131 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of compound assignment('LHS') from the first statement}}1132 LHS = RHS;1133 }1134#pragma acc atomic capture1135 {1136 LHS /= 1;1137 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1138 // expected-note@+1{{expected assignment expression}}1139 RHS += LHS;1140 }1141 1142 // { x = x binop expr; v = x; }1143#pragma acc atomic capture1144 {1145 LHS = LHS + 1;1146 RHS = LHS;1147 }1148 1149#pragma acc atomic capture1150 {1151 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1152 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and '1')}}1153 LHS = RHS - 1;1154 RHS = LHS;1155 }1156#pragma acc atomic capture1157 {1158 LHS = LHS * 1;1159 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1160 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}1161 RHS = RHS;1162 }1163#pragma acc atomic capture1164 {1165 LHS = LHS / 1;1166 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1167 // expected-note@+1{{expected assignment expression}}1168 RHS += LHS;1169 }1170 1171 // { x = expr binop x; v = x; }1172#pragma acc atomic capture1173 {1174 LHS = 1 ^ LHS;1175 RHS = LHS;1176 }1177 1178#pragma acc atomic capture1179 {1180 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1181 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('1' and 'RHS')}}1182 LHS = 1 & RHS;1183 RHS = LHS;1184 }1185#pragma acc atomic capture1186 {1187 LHS = LHS | 1;1188 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1189 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}1190 RHS = RHS;1191 }1192#pragma acc atomic capture1193 {1194 LHS = LHS << 1;1195 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1196 // expected-note@+1{{expected assignment expression}}1197 RHS += LHS;1198 }1199 1200 // { v = x; x binop = expr; }1201#pragma acc atomic capture1202 {1203 LHS = RHS;1204 RHS += 1;1205 }1206 1207 // { v = x; x = x binop expr; }1208#pragma acc atomic capture1209 {1210 LHS = RHS;1211 RHS = RHS / 1;1212 }1213#pragma acc atomic capture1214 {1215 LHS = RHS;1216 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1217 // expected-note@+1{{left hand side of assignment operation('RHS') must match one side of the sub-operation on the right hand side('LHS' and '1')}}1218 RHS = LHS ^ 1;1219 }1220#pragma acc atomic capture1221 {1222 LHS = RHS;1223 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1224 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and '1')}}1225 LHS = RHS << 1;1226 }1227 // { v = x; x = expr binop x; }1228#pragma acc atomic capture1229 {1230 LHS = RHS;1231 RHS = 1 / RHS;1232 }1233#pragma acc atomic capture1234 {1235 LHS = RHS;1236 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1237 // expected-note@+1{{left hand side of assignment operation('RHS') must match one side of the sub-operation on the right hand side('1' and 'LHS')}}1238 RHS = 1 ^ LHS;1239 }1240#pragma acc atomic capture1241 {1242 LHS = RHS;1243 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1244 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('1' and 'RHS')}}1245 LHS = 1 << RHS;1246 }1247 1248 // { v = x; x = expr; }1249#pragma acc atomic capture1250 {1251 LHS = RHS;1252 RHS = 1;1253 }1254#pragma acc atomic capture1255 {1256 LHS = RHS;1257 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1258 // expected-note@+1{{sub-expression on left hand side of assignment('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}1259 LHS = 1;1260 }1261 1262 // { v = x; x++; }1263 // { v = x; ++x; }1264 // { v = x; x--; }1265 // { v = x; --x; }1266#pragma acc atomic capture1267 {1268 LHS = RHS;1269 RHS++;1270 }1271#pragma acc atomic capture1272 {1273 LHS = RHS;1274 RHS--;1275 }1276#pragma acc atomic capture1277 {1278 LHS = RHS;1279 ++RHS;1280 }1281#pragma acc atomic capture1282 {1283 LHS = RHS;1284 --RHS;1285 }1286#pragma acc atomic capture1287 {1288 LHS = RHS;1289 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1290 // expected-note@+1{{unary operator not supported, only increment and decrement operations permitted}}1291 -RHS;1292 }1293#pragma acc atomic capture1294 {1295 LHS = RHS;1296 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1297 // expected-note@+1{{sub-expression in unary expression('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}1298 LHS++;1299 }1300}1301 1302template<typename T>1303void AtomicCaptureTemplateCompound2(T LHS, T RHS) {1304 1305 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1306 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}1307#pragma acc atomic capture1308 {1309 }1310 1311 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1312 // expected-note@+4{{expected assignment, compound assignment, increment, or decrement expression}}1313#pragma acc atomic capture1314 {1315 LHS = RHS;1316 }1317 1318 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1319 // expected-note@+3{{'atomic capture' with a compound statement only supports two statements}}1320#pragma acc atomic capture1321 {1322 LHS = RHS; RHS += 1; LHS=RHS;1323 }1324 1325 1326#pragma acc atomic capture1327 {1328 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1329 // expected-note@+1{{operand to increment expression must be of scalar type (was 'Struct')}}1330 LHS++;1331 RHS = LHS;1332 }1333 1334#pragma acc atomic capture1335 {1336 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1337 // expected-note@+1{{operand to increment expression must be of scalar type (was 'Struct')}}1338 ++LHS;1339 RHS = LHS;1340 }1341 1342#pragma acc atomic capture1343 {1344 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1345 // expected-note@+1{{operand to decrement expression must be of scalar type (was 'Struct')}}1346 --LHS;1347 RHS = LHS;1348 }1349 1350 1351#pragma acc atomic capture1352 {1353 LHS--;1354 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1355 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used in unary expression('LHS') from the first statement}}1356 LHS = RHS;1357 }1358 1359#pragma acc atomic capture1360 {1361 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1362 // expected-note@+1{{unary operator not supported, only increment and decrement operations permitted}}1363 -LHS;1364 RHS = LHS;1365 }1366 1367#pragma acc atomic capture1368 {1369 --LHS;1370 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1371 // expected-note@+1{{expected assignment expression}}1372 RHS += LHS;1373 }1374 1375 // { x binop = expr; v = x; }1376#pragma acc atomic capture1377 {1378 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1379 // expected-note@+1{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}1380 LHS += 1;1381 RHS = LHS;1382 }1383#pragma acc atomic capture1384 {1385 LHS *= 1;1386 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1387 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of compound assignment('LHS') from the first statement}}1388 LHS = RHS;1389 }1390#pragma acc atomic capture1391 {1392 LHS /= 1;1393 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1394 // expected-note@+1{{expected assignment expression}}1395 RHS += LHS;1396 }1397 1398 // { x = x binop expr; v = x; }1399#pragma acc atomic capture1400 {1401 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1402 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1403 LHS = LHS + 1;1404 RHS = LHS;1405 }1406 1407#pragma acc atomic capture1408 {1409 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1410 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and '1')}}1411 LHS = RHS - 1;1412 RHS = LHS;1413 }1414#pragma acc atomic capture1415 {1416 LHS = LHS * 1;1417 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1418 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}1419 RHS = RHS;1420 }1421#pragma acc atomic capture1422 {1423 LHS = LHS / 1;1424 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1425 // expected-note@+1{{expected assignment expression}}1426 RHS += LHS;1427 }1428 1429 // { x = expr binop x; v = x; }1430#pragma acc atomic capture1431 {1432 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1433 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1434 LHS = 1 ^ LHS;1435 RHS = LHS;1436 }1437 1438#pragma acc atomic capture1439 {1440 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1441 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('1' and 'RHS')}}1442 LHS = 1 & RHS;1443 RHS = LHS;1444 }1445#pragma acc atomic capture1446 {1447 LHS = LHS | 1;1448 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1449 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}1450 RHS = RHS;1451 }1452#pragma acc atomic capture1453 {1454 LHS = LHS << 1;1455 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1456 // expected-note@+1{{expected assignment expression}}1457 RHS += LHS;1458 }1459 1460 // { v = x; x binop = expr; }1461#pragma acc atomic capture1462 {1463 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1464 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1465 LHS = RHS;1466 RHS += 1;1467 }1468 1469 // { v = x; x = x binop expr; }1470#pragma acc atomic capture1471 {1472 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1473 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1474 LHS = RHS;1475 RHS = RHS / 1;1476 }1477#pragma acc atomic capture1478 {1479 LHS = RHS;1480 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1481 // expected-note@+1{{left hand side of assignment operation('RHS') must match one side of the sub-operation on the right hand side('LHS' and '1')}}1482 RHS = LHS ^ 1;1483 }1484#pragma acc atomic capture1485 {1486 LHS = RHS;1487 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1488 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and '1')}}1489 LHS = RHS << 1;1490 }1491 // { v = x; x = expr binop x; }1492#pragma acc atomic capture1493 {1494 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1495 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1496 LHS = RHS;1497 RHS = 1 / RHS;1498 }1499#pragma acc atomic capture1500 {1501 LHS = RHS;1502 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1503 // expected-note@+1{{left hand side of assignment operation('RHS') must match one side of the sub-operation on the right hand side('1' and 'LHS')}}1504 RHS = 1 ^ LHS;1505 }1506#pragma acc atomic capture1507 {1508 LHS = RHS;1509 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1510 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('1' and 'RHS')}}1511 LHS = 1 << RHS;1512 }1513 1514 // { v = x; x = expr; }1515#pragma acc atomic capture1516 {1517 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1518 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1519 LHS = RHS;1520 RHS = 1;1521 }1522#pragma acc atomic capture1523 {1524 LHS = RHS;1525 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1526 // expected-note@+1{{sub-expression on left hand side of assignment('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}1527 LHS = 1;1528 }1529 1530 // { v = x; x++; }1531 // { v = x; ++x; }1532 // { v = x; x--; }1533 // { v = x; --x; }1534#pragma acc atomic capture1535 {1536 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1537 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1538 LHS = RHS;1539 RHS++;1540 }1541#pragma acc atomic capture1542 {1543 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1544 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1545 LHS = RHS;1546 RHS--;1547 }1548#pragma acc atomic capture1549 {1550 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1551 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1552 LHS = RHS;1553 ++RHS;1554 }1555#pragma acc atomic capture1556 {1557 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1558 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1559 LHS = RHS;1560 --RHS;1561 }1562#pragma acc atomic capture1563 {1564 LHS = RHS;1565 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1566 // expected-note@+1{{unary operator not supported, only increment and decrement operations permitted}}1567 -RHS;1568 }1569#pragma acc atomic capture1570 {1571 LHS = RHS;1572 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1573 // expected-note@+1{{sub-expression in unary expression('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}1574 LHS++;1575 }1576}1577void AtomicCaptureCompound(int LHS, int RHS) {1578 AtomicCaptureTemplateCompound(1, 2); 1579 AtomicCaptureTemplateCompound2(S1, S2); //expected-note{{in instantiation of function template specialization}}1580 1581 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1582 // expected-note@+2{{expected assignment, compound assignment, increment, or decrement expression}}1583#pragma acc atomic capture1584 {1585 }1586 1587 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1588 // expected-note@+4{{expected assignment, compound assignment, increment, or decrement expression}}1589#pragma acc atomic capture1590 {1591 LHS = RHS;1592 }1593 1594 // expected-error@+2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1595 // expected-note@+3{{'atomic capture' with a compound statement only supports two statements}}1596#pragma acc atomic capture1597 {1598 LHS = RHS; RHS += 1; LHS=RHS;1599 }1600 1601 1602#pragma acc atomic capture1603 {1604 LHS++;1605 RHS = LHS;1606 }1607#pragma acc atomic capture1608 {1609 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1610 // expected-note@+1{{operand to increment expression must be of scalar type (was 'Struct')}}1611 S1++;1612 S2= S1;1613 }1614 1615#pragma acc atomic capture1616 {1617 ++LHS;1618 RHS = LHS;1619 }1620 1621#pragma acc atomic capture1622 {1623 --LHS;1624 RHS = LHS;1625 }1626 1627 1628#pragma acc atomic capture1629 {1630 LHS--;1631 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1632 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used in unary expression('LHS') from the first statement}}1633 LHS = RHS;1634 }1635 1636#pragma acc atomic capture1637 {1638 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1639 // expected-note@+1{{unary operator not supported, only increment and decrement operations permitted}}1640 -LHS;1641 RHS = LHS;1642 }1643 1644#pragma acc atomic capture1645 {1646 --LHS;1647 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1648 // expected-note@+1{{expected assignment expression}}1649 RHS += LHS;1650 }1651 1652 // { x binop = expr; v = x; }1653#pragma acc atomic capture1654 {1655 LHS += 1;1656 RHS = LHS;1657 }1658#pragma acc atomic capture1659 {1660 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1661 // expected-note@+1{{left operand to compound assignment expression must be of scalar type (was 'Struct')}}1662 S1 += 1;1663 S2= S1;1664 }1665#pragma acc atomic capture1666 {1667 LHS *= 1;1668 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1669 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of compound assignment('LHS') from the first statement}}1670 LHS = RHS;1671 }1672#pragma acc atomic capture1673 {1674 LHS /= 1;1675 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1676 // expected-note@+1{{expected assignment expression}}1677 RHS += LHS;1678 }1679 1680 // { x = x binop expr; v = x; }1681#pragma acc atomic capture1682 {1683 LHS = LHS + 1;1684 RHS = LHS;1685 }1686#pragma acc atomic capture1687 {1688 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1689 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1690 S1 = S1 + 1;1691 S2= S1;1692 }1693 1694#pragma acc atomic capture1695 {1696 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1697 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and '1')}}1698 LHS = RHS - 1;1699 RHS = LHS;1700 }1701#pragma acc atomic capture1702 {1703 LHS = LHS * 1;1704 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1705 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}1706 RHS = RHS;1707 }1708#pragma acc atomic capture1709 {1710 LHS = LHS / 1;1711 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1712 // expected-note@+1{{expected assignment expression}}1713 RHS += LHS;1714 }1715 1716 // { x = expr binop x; v = x; }1717#pragma acc atomic capture1718 {1719 LHS = 1 ^ LHS;1720 RHS = LHS;1721 }1722#pragma acc atomic capture1723 {1724 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1725 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1726 S1 = 1 ^ S1;1727 S2 = S1;1728 }1729 1730#pragma acc atomic capture1731 {1732 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1733 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('1' and 'RHS')}}1734 LHS = 1 & RHS;1735 RHS = LHS;1736 }1737#pragma acc atomic capture1738 {1739 LHS = LHS | 1;1740 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1741 // expected-note@+1{{sub-expression on right hand side of assignment('RHS') must match sub-expression used on left hand side of assignment('LHS') from the first statement}}1742 RHS = RHS;1743 }1744#pragma acc atomic capture1745 {1746 LHS = LHS << 1;1747 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1748 // expected-note@+1{{expected assignment expression}}1749 RHS += LHS;1750 }1751 1752 // { v = x; x binop = expr; }1753#pragma acc atomic capture1754 {1755 LHS = RHS;1756 RHS += 1;1757 }1758 1759#pragma acc atomic capture1760 {1761 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1762 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1763 S1 = S2;1764 S2 += 1;1765 }1766 1767 // { v = x; x = x binop expr; }1768#pragma acc atomic capture1769 {1770 LHS = RHS;1771 RHS = RHS / 1;1772 }1773#pragma acc atomic capture1774 {1775 LHS = RHS;1776 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1777 // expected-note@+1{{left hand side of assignment operation('RHS') must match one side of the sub-operation on the right hand side('LHS' and '1')}}1778 RHS = LHS ^ 1;1779 }1780#pragma acc atomic capture1781 {1782 LHS = RHS;1783 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1784 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('RHS' and '1')}}1785 LHS = RHS << 1;1786 }1787 // { v = x; x = expr binop x; }1788#pragma acc atomic capture1789 {1790 LHS = RHS;1791 RHS = 1 / RHS;1792 }1793#pragma acc atomic capture1794 {1795 LHS = RHS;1796 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1797 // expected-note@+1{{left hand side of assignment operation('RHS') must match one side of the sub-operation on the right hand side('1' and 'LHS')}}1798 RHS = 1 ^ LHS;1799 }1800#pragma acc atomic capture1801 {1802 LHS = RHS;1803 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1804 // expected-note@+1{{left hand side of assignment operation('LHS') must match one side of the sub-operation on the right hand side('1' and 'RHS')}}1805 LHS = 1 << RHS;1806 }1807 1808 // { v = x; x = expr; }1809#pragma acc atomic capture1810 {1811 LHS = RHS;1812 RHS = 1;1813 }1814#pragma acc atomic capture1815 {1816 LHS = RHS;1817 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1818 // expected-note@+1{{sub-expression on left hand side of assignment('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}1819 LHS = 1;1820 }1821 1822 // { v = x; x++; }1823 // { v = x; ++x; }1824 // { v = x; x--; }1825 // { v = x; --x; }1826#pragma acc atomic capture1827 {1828 LHS = RHS;1829 RHS++;1830 }1831#pragma acc atomic capture1832 {1833 LHS = RHS;1834 RHS--;1835 }1836#pragma acc atomic capture1837 {1838 LHS = RHS;1839 ++RHS;1840 }1841#pragma acc atomic capture1842 {1843 LHS = RHS;1844 --RHS;1845 }1846#pragma acc atomic capture1847 {1848 // expected-error@-2{{statement associated with OpenACC 'atomic capture' directive is invalid}}1849 // expected-note@+1{{left operand to assignment expression must be of scalar type (was 'Struct')}}1850 S1= S2;1851 --S2;1852 }1853#pragma acc atomic capture1854 {1855 LHS = RHS;1856 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1857 // expected-note@+1{{unary operator not supported, only increment and decrement operations permitted}}1858 -RHS;1859 }1860#pragma acc atomic capture1861 {1862 LHS = RHS;1863 // expected-error@-3{{statement associated with OpenACC 'atomic capture' directive is invalid}}1864 // expected-note@+1{{sub-expression in unary expression('LHS') must match sub-expression used on right hand side of assignment('RHS') from the first statement}}1865 LHS++;1866 }1867 1868 // Example from UDel test suite, which wasn't working because of irrelevant1869 // parens, make sure we work with these. This should not diagnose.1870 typedef double real_t;1871 int * distribution;1872 real_t *a;1873 real_t *b;1874 int *c;1875 for (int x = 0; x < 5; ++x) {1876#pragma acc atomic capture1877 {1878 c[x] = distribution[(int) (a[x]*b[x]/10)];1879 (distribution[(int)(a[x]*b[x]/10)])--;1880 }1881 }1882 1883}1884