diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-20 08:22:04 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-09-20 08:22:04 +0000 |
commit | eaa3785fd8b183ba6d31bc4ac8aae93db7086986 (patch) | |
tree | a5bcdf81dc6a40d882179bebad319e8d9f329bc8 /gcc/c-omp.c | |
parent | 99efba317ec83f8be14c02a2c3d8903a4dd5d5aa (diff) | |
download | gcc-eaa3785fd8b183ba6d31bc4ac8aae93db7086986.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117077 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-omp.c')
-rw-r--r-- | gcc/c-omp.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-omp.c b/gcc/c-omp.c index fe56824401c..0bae32140d8 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 |