diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-02-06 11:34:53 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-02-06 11:34:53 +0100 |
commit | 6d840d998086aa54b0a43c45b7a323f0408bf308 (patch) | |
tree | 091d383fc8916e747be9e17db128fffaa6963396 /gcc/omp-low.c | |
parent | ca4a4fe903f536b400f1708437a69df637cf2c7f (diff) | |
download | gcc-6d840d998086aa54b0a43c45b7a323f0408bf308.zip gcc-6d840d998086aa54b0a43c45b7a323f0408bf308.tar.gz gcc-6d840d998086aa54b0a43c45b7a323f0408bf308.tar.bz2 |
re PR c++/56217 (ICE: OpenMP: when combining shared() and a move constructor)
PR middle-end/56217
* omp-low.c (use_pointer_for_field): Return false if
lower_send_shared_vars doesn't generate any copy-out code.
* g++.dg/gomp/pr56217.C: New test.
* testsuite/libgomp.c++/pr56217.C: New test.
From-SVN: r195796
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index e09024a..ef4ed5e 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -757,12 +757,20 @@ use_pointer_for_field (tree decl, omp_context *shared_ctx) if (TREE_ADDRESSABLE (decl)) return true; + /* lower_send_shared_vars only uses copy-in, but not copy-out + for these. */ + if (TREE_READONLY (decl) + || ((TREE_CODE (decl) == RESULT_DECL + || TREE_CODE (decl) == PARM_DECL) + && DECL_BY_REFERENCE (decl))) + return false; + /* Disallow copy-in/out in nested parallel if decl is shared in outer parallel, otherwise each thread could store the shared variable in its own copy-in location, making the variable no longer really shared. */ - if (!TREE_READONLY (decl) && shared_ctx->is_nested) + if (shared_ctx->is_nested) { omp_context *up; @@ -785,11 +793,10 @@ use_pointer_for_field (tree decl, omp_context *shared_ctx) } } - /* For tasks avoid using copy-in/out, unless they are readonly - (in which case just copy-in is used). As tasks can be + /* For tasks avoid using copy-in/out. As tasks can be deferred or executed in different thread, when GOMP_task returns, the task hasn't necessarily terminated. */ - if (!TREE_READONLY (decl) && is_task_ctx (shared_ctx)) + if (is_task_ctx (shared_ctx)) { tree outer; maybe_mark_addressable_and_ret: |