Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaOpenMP.cpp +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp @@ -6163,7 +6163,7 @@ AtomicCompAssignOp->getOpcode()); OpLoc = AtomicCompAssignOp->getOperatorLoc(); E = AtomicCompAssignOp->getRHS(); - X = AtomicCompAssignOp->getLHS(); + X = AtomicCompAssignOp->getLHS()->IgnoreParens(); IsXLHSInRHSPart = true; } else if (auto *AtomicBinOp = dyn_cast( AtomicBody->IgnoreParenImpCasts())) { @@ -6177,7 +6177,7 @@ IsPostfixUpdate = AtomicUnaryOp->isPostfix(); Op = AtomicUnaryOp->isIncrementOp() ? BO_Add : BO_Sub; OpLoc = AtomicUnaryOp->getOperatorLoc(); - X = AtomicUnaryOp->getSubExpr(); + X = AtomicUnaryOp->getSubExpr()->IgnoreParens(); E = SemaRef.ActOnIntegerConstant(OpLoc, /*uint64_t Val=*/1).get(); IsXLHSInRHSPart = true; } else { Index: cfe/trunk/test/OpenMP/atomic_messages.c =================================================================== --- cfe/trunk/test/OpenMP/atomic_messages.c +++ cfe/trunk/test/OpenMP/atomic_messages.c @@ -313,6 +313,8 @@ #pragma omp atomic capture {c = a; a++;} #pragma omp atomic capture + {c = a; (a)++;} +#pragma omp atomic capture {++a;c = a;} #pragma omp atomic capture {c = a;a--;} @@ -321,6 +323,8 @@ #pragma omp atomic capture {c = a; a += b;} #pragma omp atomic capture + {c = a; (a) += b;} +#pragma omp atomic capture {a %= b; c = a;} #pragma omp atomic capture {c = a; a *= b;} Index: cfe/trunk/test/OpenMP/atomic_messages.cpp =================================================================== --- cfe/trunk/test/OpenMP/atomic_messages.cpp +++ cfe/trunk/test/OpenMP/atomic_messages.cpp @@ -453,6 +453,8 @@ #pragma omp atomic capture {c = a; a++;} #pragma omp atomic capture + {c = a; (a)++;} +#pragma omp atomic capture {++a;c = a;} #pragma omp atomic capture {c = a;a--;} @@ -461,6 +463,8 @@ #pragma omp atomic capture {c = a; a += b;} #pragma omp atomic capture + {c = a; (a) += b;} +#pragma omp atomic capture {a %= b; c = a;} #pragma omp atomic capture {c = a; a *= b;}