aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-omp.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-09-20 10:22:04 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-09-20 10:22:04 +0200
commit66bb4f322eb936da1051767834df0db13502d8fb (patch)
treea5bcdf81dc6a40d882179bebad319e8d9f329bc8 /gcc/c-omp.c
parent1e993cb82d600a1d2d798d18454a8c2c8d4c7679 (diff)
downloadgcc-66bb4f322eb936da1051767834df0db13502d8fb.zip
gcc-66bb4f322eb936da1051767834df0db13502d8fb.tar.gz
gcc-66bb4f322eb936da1051767834df0db13502d8fb.tar.bz2
re PR middle-end/28046 (libgomp test pr27337.C fails intermittently)
PR middle-end/28046 * c-omp.c (c_finish_omp_atomic): If ADDR is not simple enough, wrap it into TARGET_EXPR. * gcc.dg/gomp/atomic-10.c: New test. * g++.dg/gomp/atomic-10.C: New test. From-SVN: r117077
Diffstat (limited to 'gcc/c-omp.c')
-rw-r--r--gcc/c-omp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-omp.c b/gcc/c-omp.c
index fe56824..0bae321 100644
--- a/gcc/c-omp.c
+++ b/gcc/c-omp.c
@@ -116,6 +116,15 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
if (addr == error_mark_node)
return error_mark_node;
addr = save_expr (addr);
+ if (TREE_CODE (addr) != SAVE_EXPR
+ && (TREE_CODE (addr) != ADDR_EXPR
+ || TREE_CODE (TREE_OPERAND (addr, 0)) != VAR_DECL))
+ {
+ /* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize
+ it even after unsharing function body. */
+ tree var = create_tmp_var_raw (TREE_TYPE (addr), NULL);
+ addr = build4 (TARGET_EXPR, TREE_TYPE (addr), var, addr, NULL, NULL);
+ }
lhs = build_indirect_ref (addr, NULL);
/* There are lots of warnings, errors, and conversions that need to happen