This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[committed] Fix error-recovery on OpenMP clause with unusable copy-ctor/dtor (PR c++/81011)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 8 Jun 2017 21:08:11 +0200
- Subject: [committed] Fix error-recovery on OpenMP clause with unusable copy-ctor/dtor (PR c++/81011)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 21FFB51EFE
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 21FFB51EFE
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
If we can't copy construct, or destruct etc. a privatized variable,
for error-recovery we turn it into a shared clause that doesn't need that.
But starting with GCC 6 there are two OMP_CLAUSE_SHARED_* bits that mean
something different on other clauses, so we need to clear them.
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk
and 7.x/6.x.
2017-06-08 Jakub Jelinek <jakub@redhat.com>
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.
--- gcc/cp/cp-gimplify.c.jj 2017-06-07 10:45:32.000000000 +0200
+++ gcc/cp/cp-gimplify.c 2017-06-08 13:24:48.639272627 +0200
@@ -1912,7 +1912,11 @@ cxx_omp_finish_clause (tree c, gimple_se
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
--- gcc/testsuite/g++.dg/gomp/pr81011.C.jj 2017-06-08 13:33:28.226656742 +0200
+++ gcc/testsuite/g++.dg/gomp/pr81011.C 2017-06-08 13:33:07.000000000 +0200
@@ -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);
+}
Jakub