Hi!

The following testcase ICEs, because for parallel combined with some
other construct we initialize the omp_parallel_combined_clauses pointer
and expect the construct combined with it to clear it after it no longer
needs it, but OMP_MASTER didn't do that.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk,
queued for backporting.

2020-04-04  Jakub Jelinek  <ja...@redhat.com>

        PR c++/94477
        * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
        omp_parallel_combined_clauses.

        * g++.dg/gomp/pr94477.C: New test.

--- gcc/cp/pt.c.jj      2020-04-03 20:28:50.989754551 +0200
+++ gcc/cp/pt.c 2020-04-03 21:54:29.754337004 +0200
@@ -18467,8 +18467,10 @@ tsubst_expr (tree t, tree args, tsubst_f
       add_stmt (t);
       break;
 
-    case OMP_SECTION:
     case OMP_MASTER:
+      omp_parallel_combined_clauses = NULL;
+      /* FALLTHRU */
+    case OMP_SECTION:
       stmt = push_stmt_list ();
       RECUR (OMP_BODY (t));
       stmt = pop_stmt_list (stmt);
--- gcc/testsuite/g++.dg/gomp/pr94477.C.jj      2020-04-03 21:55:10.575740787 
+0200
+++ gcc/testsuite/g++.dg/gomp/pr94477.C 2020-04-03 21:54:52.388006422 +0200
@@ -0,0 +1,18 @@
+// PR c++/94477
+// { dg-do compile }
+
+void foo ();
+
+template <int>
+void
+bar ()
+{
+  #pragma omp parallel master
+  foo ();
+}
+
+void
+baz ()
+{
+  bar<0> ();
+}

        Jakub

Reply via email to