diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-09-14 20:18:17 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-09-14 20:18:17 +0000 |
commit | a3ee44e4db821b4c21fa6dbb72b2402f14f5593d (patch) | |
tree | 3d7d0e0c7d54b8b34774a1e25e74a48dc3f235e1 | |
parent | 4bb14839b20981bb3a7d5df9f77b452d8f59c9b3 (diff) |
PR c++/81314
* cp-gimplify.c (omp_var_to_track): Look through references.
(omp_cxx_notice_variable): Likewise.
* testsuite/libgomp.c++/pr81314.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252770 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 4 | ||||
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c++/pr81314.C | 38 |
4 files changed, 53 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c0b7ba2ff69..1bda58141ce 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-09-14 Jakub Jelinek <jakub@redhat.com> + + PR c++/81314 + * cp-gimplify.c (omp_var_to_track): Look through references. + (omp_cxx_notice_variable): Likewise. + 2017-09-13 Nathan Sidwell <nathan@acm.org> Conv-op identifers not in identifier hash table diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 4a52aa50e77..262485a5c1f 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -895,6 +895,8 @@ omp_var_to_track (tree decl) tree type = TREE_TYPE (decl); if (is_invisiref_parm (decl)) type = TREE_TYPE (type); + else if (TREE_CODE (type) == REFERENCE_TYPE) + type = TREE_TYPE (type); while (TREE_CODE (type) == ARRAY_TYPE) type = TREE_TYPE (type); if (type == error_mark_node || !CLASS_TYPE_P (type)) @@ -947,6 +949,8 @@ omp_cxx_notice_variable (struct cp_genericize_omp_taskreg *omp_ctx, tree decl) tree type = TREE_TYPE (decl); if (is_invisiref_parm (decl)) type = TREE_TYPE (type); + else if (TREE_CODE (type) == REFERENCE_TYPE) + type = TREE_TYPE (type); while (TREE_CODE (type) == ARRAY_TYPE) type = TREE_TYPE (type); get_copy_ctor (type, tf_none); diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 8e50b8083dc..459dcffa570 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2017-09-14 Jakub Jelinek <jakub@redhat.com> + + PR c++/81314 + * testsuite/libgomp.c++/pr81314.C: New test. + 2017-09-03 Gerald Pfeifer <gerald@pfeifer.com> * libgomp.texi (Top): www.openacc.org now uses https. diff --git a/libgomp/testsuite/libgomp.c++/pr81314.C b/libgomp/testsuite/libgomp.c++/pr81314.C new file mode 100644 index 00000000000..afe89438bd3 --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/pr81314.C @@ -0,0 +1,38 @@ +// PR c++/81314 +// { dg-do link } + +template <int N> +struct S { + S () { s = 0; } + S (const S &x) { s = x.s; } + ~S () {} + int s; +}; + +void +foo (S<2> &x) +{ + #pragma omp taskloop + for (int i = 0; i < 100; ++i) + x.s++; +} + +void +bar (S<3> &x) +{ + #pragma omp task + x.s++; +} + +int +main () +{ + S<2> s; + S<3> t; + #pragma omp parallel + #pragma omp master + { + foo (s); + bar (t); + } +} |