goto saw_error;
if (code == NOP_EXPR)
{
- lhs = c_parser_expression (parser).value;
- lhs = c_fully_fold (lhs, false, NULL);
- if (lhs == error_mark_node)
+ eloc = c_parser_peek_token (parser)->location;
+ expr = c_parser_expression (parser);
+ expr = default_function_array_read_conversion (eloc, expr);
+ /* atomic write is represented by OMP_ATOMIC with NOP_EXPR
+ opcode. */
+ code = OMP_ATOMIC;
+ lhs = v;
+ v = NULL_TREE;
+ rhs = c_fully_fold (expr.value, false, NULL);
+ if (rhs == error_mark_node)
goto saw_error;
}
else
if (non_lvalue_p)
lhs = non_lvalue (lhs);
}
- if (code == NOP_EXPR)
- {
- /* atomic write is represented by OMP_ATOMIC with NOP_EXPR
- opcode. */
- code = OMP_ATOMIC;
- rhs = lhs;
- lhs = v;
- v = NULL_TREE;
- }
goto done;
case OMP_ATOMIC_CAPTURE_NEW:
if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
--- /dev/null
+/* PR c/119000 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -Wunused-but-set-variable" } */
+
+int
+foo (void)
+{
+ int a = 1, b, c = 1, v; /* { dg-warning "variable 'b' set but not used" } */
+ #pragma omp atomic write
+ v = a;
+ #pragma omp atomic read
+ b = v;
+ #pragma omp atomic update
+ v += c;
+ return v;
+}