summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-omp.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-family/c-omp.c')
-rw-r--r--gcc/c-family/c-omp.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 1691c40f11a..5ccb62eea50 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -199,6 +199,11 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
error_at (loc, "invalid expression type for %<#pragma omp atomic%>");
return error_mark_node;
}
+ if (TYPE_ATOMIC (type))
+ {
+ error_at (loc, "%<_Atomic%> expression in %<#pragma omp atomic%>");
+ return error_mark_node;
+ }
if (opcode == RDIV_EXPR)
opcode = TRUNC_DIV_EXPR;
@@ -207,7 +212,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
/* Take and save the address of the lhs. From then on we'll reference it
via indirection. */
- addr = build_unary_op (loc, ADDR_EXPR, lhs, 0);
+ addr = build_unary_op (loc, ADDR_EXPR, lhs, false);
if (addr == error_mark_node)
return error_mark_node;
if (!test)
@@ -298,14 +303,14 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
loc, x, NULL_TREE);
if (rhs1 && rhs1 != lhs)
{
- tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, 0);
+ tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false);
if (rhs1addr == error_mark_node)
return error_mark_node;
x = omit_one_operand_loc (loc, type, x, rhs1addr);
}
if (lhs1 && lhs1 != lhs)
{
- tree lhs1addr = build_unary_op (loc, ADDR_EXPR, lhs1, 0);
+ tree lhs1addr = build_unary_op (loc, ADDR_EXPR, lhs1, false);
if (lhs1addr == error_mark_node)
return error_mark_node;
if (code == OMP_ATOMIC_CAPTURE_OLD)
@@ -320,7 +325,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
}
else if (rhs1 && rhs1 != lhs)
{
- tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, 0);
+ tree rhs1addr = build_unary_op (loc, ADDR_EXPR, rhs1, false);
if (rhs1addr == error_mark_node)
return error_mark_node;
x = omit_one_operand_loc (loc, type, x, rhs1addr);
@@ -480,6 +485,14 @@ c_finish_omp_for (location_t locus, enum tree_code code, tree declv,
error_at (elocus, "invalid type for iteration variable %qE", decl);
fail = true;
}
+ else if (TYPE_ATOMIC (TREE_TYPE (decl)))
+ {
+ error_at (elocus, "%<_Atomic%> iteration variable %qE", decl);
+ fail = true;
+ /* _Atomic iterator confuses stuff too much, so we risk ICE
+ trying to diagnose it further. */
+ continue;
+ }
/* In the case of "for (int i = 0...)", init will be a decl. It should
have a DECL_INITIAL that we can turn into an assignment. */