From: Jakub Jelinek Date: Thu, 8 Jun 2017 18:55:04 +0000 (+0200) Subject: re PR c++/81011 (ICE with #pragma omp task and inaccessible copy-constructor) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=34361776fb238310222e0b24d4f0b51a3717a785;p=gcc.git re PR c++/81011 (ICE with #pragma omp task and inaccessible copy-constructor) PR c++/81011 * cp-gimplify.c (cxx_omp_finish_clause): When changing clause to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE and OMP_CLAUSE_SHARED_READONLY flags. * g++.dg/gomp/pr81011.C: New test. From-SVN: r249031 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14f33c77989..bb0466d156d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2017-06-08 Jakub Jelinek + + PR c++/81011 + * cp-gimplify.c (cxx_omp_finish_clause): When changing clause + to OMP_CLAUSE_SHARED, also clear OMP_CLAUSE_SHARED_FIRSTPRIVATE + and OMP_CLAUSE_SHARED_READONLY flags. + 2017-06-08 Jan Hubicka * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 898a5ae2ae4..106d7224214 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1912,7 +1912,11 @@ cxx_omp_finish_clause (tree c, gimple_seq *) make_shared = true; if (make_shared) - OMP_CLAUSE_CODE (c) = OMP_CLAUSE_SHARED; + { + OMP_CLAUSE_CODE (c) = OMP_CLAUSE_SHARED; + OMP_CLAUSE_SHARED_FIRSTPRIVATE (c) = 0; + OMP_CLAUSE_SHARED_READONLY (c) = 0; + } } /* Return true if DECL's DECL_VALUE_EXPR (if any) should be diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 60d3e93f7a5..956f40005a1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-06-08 Jakub Jelinek + PR c++/81011 + * g++.dg/gomp/pr81011.C: New test. + PR middle-end/81005 * c-c++-common/ubsan/align-10.c: New test. * c-c++-common/ubsan/null-13.c: New test. diff --git a/gcc/testsuite/g++.dg/gomp/pr81011.C b/gcc/testsuite/g++.dg/gomp/pr81011.C new file mode 100644 index 00000000000..4abd609596c --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr81011.C @@ -0,0 +1,19 @@ +// PR c++/81011 +// { dg-do compile } + +class A { A (const A&); }; // { dg-message "declared private here" } +void foo (const A&); + +void +bar (A& a) +{ +#pragma omp task // { dg-error "is private within this context" } + foo (a); +} + +void +baz (A& a) +{ +#pragma omp task firstprivate (a) // { dg-error "is private within this context" } + foo (a); +}