aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-omp.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-06-15 03:26:38 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-06-15 03:26:38 +0000
commitfe89d79748951c95a113e10b6184ca5284d3936d (patch)
tree2419236a5dd577e978264804fe2c75548fb14e25 /gcc/c-omp.c
parent801522dead7b6e710f78eb26017195c814db04a2 (diff)
downloadgcc-fe89d79748951c95a113e10b6184ca5284d3936d.zip
gcc-fe89d79748951c95a113e10b6184ca5284d3936d.tar.gz
gcc-fe89d79748951c95a113e10b6184ca5284d3936d.tar.bz2
re PR c++/26559 (ICE with __builtin_constant_p in template argument)
2006-06-14 Mark Mitchell <mark@codesourcery.com> PR c++/26559 * c-common.h (c_finish_omp_atomic): Adjust declaration. * c-omp.c (c_finish_omp_atomic): Return the expression to perform, rather than calling add_stmt on it. * c-parser.c (c_parser_omp_atomic): Adjust accordingly. 2006-06-14 Mark Mitchell <mark@codesourcery.com> PR c++/26559 * pt.c (tsubst_expr): Use finish_omp_atomic. (value_dependent_expression_p): All CALL_EXPRs are dependent. * semantics.c (finish_omp_atomic): Rework to use standard paradigms for handling non-dependent expressions. 2006-06-14 Mark Mitchell <mark@codesourcery.com> PR c++/26559 * g++.dg/template/builtin1.C: New test. * g++.dg/gomp/tpl-atomic-2.C: Remove XFAIL. From-SVN: r114665
Diffstat (limited to 'gcc/c-omp.c')
-rw-r--r--gcc/c-omp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/c-omp.c b/gcc/c-omp.c
index ac107e6..fe56824 100644
--- a/gcc/c-omp.c
+++ b/gcc/c-omp.c
@@ -82,15 +82,18 @@ c_finish_omp_barrier (void)
/* Complete a #pragma omp atomic construct. The expression to be
- implemented atomically is LHS code= RHS. */
+ implemented atomically is LHS code= RHS. The value returned is
+ either error_mark_node (if the construct was erroneous) or an
+ OMP_ATOMIC node which should be added to the current statement tree
+ with add_stmt. */
-void
+tree
c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
{
tree x, type, addr;
if (lhs == error_mark_node || rhs == error_mark_node)
- return;
+ return error_mark_node;
/* ??? According to one reading of the OpenMP spec, complex type are
supported, but there are no atomic stores for any architecture.
@@ -102,7 +105,7 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
&& !SCALAR_FLOAT_TYPE_P (type))
{
error ("invalid expression type for %<#pragma omp atomic%>");
- return;
+ return error_mark_node;
}
/* ??? Validate that rhs does not overlap lhs. */
@@ -111,7 +114,7 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
via indirection. */
addr = build_unary_op (ADDR_EXPR, lhs, 0);
if (addr == error_mark_node)
- return;
+ return error_mark_node;
addr = save_expr (addr);
lhs = build_indirect_ref (addr, NULL);
@@ -120,12 +123,12 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
to do this, and then take it apart again. */
x = build_modify_expr (lhs, code, rhs);
if (x == error_mark_node)
- return;
+ return error_mark_node;
gcc_assert (TREE_CODE (x) == MODIFY_EXPR);
rhs = TREE_OPERAND (x, 1);
/* Punt the actual generation of atomic operations to common code. */
- add_stmt (build2 (OMP_ATOMIC, void_type_node, addr, rhs));
+ return build2 (OMP_ATOMIC, void_type_node, addr, rhs);
}