re PR c++/81011 (ICE with #pragma omp task and inaccessible copy-constructor)
authorJakub Jelinek <jakub@redhat.com>
Thu, 8 Jun 2017 18:55:04 +0000 (20:55 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 8 Jun 2017 18:55:04 +0000 (20:55 +0200)
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

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr81011.C [new file with mode: 0644]

index 14f33c7798968cc89038fc7aa7dca8978a24717d..bb0466d156d370eccfd6e8dd9b7f267dccf6deda 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2017-06-08  Jan Hubicka  <hubicka@ucw.cz>
 
        * cp-tree.h (lang_check_failed): Annotate by ATTRIBUTE_COLD.
index 898a5ae2ae42cfa3bdf7ea6a1d2ad24735e466ab..106d722421491bfb8d33bf561bbaec3d0b279691 100644 (file)
@@ -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
index 60d3e93f7a5ad677eee8a57326ca45ffce50886b..956f40005a13a2332d17c55cb3bafb51c0172c77 100644 (file)
@@ -1,5 +1,8 @@
 2017-06-08  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..4abd609
--- /dev/null
@@ -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);
+}