From: Jakub Jelinek Date: Fri, 3 Apr 2020 22:35:41 +0000 (+0200) Subject: openmp: Fix ICE on #pragma omp parallel master in template [PR94477] X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c809f727cd2a6c70c307d9dd53d26dc84bf292a;p=gcc.git openmp: Fix ICE on #pragma omp parallel master in template [PR94477] 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. 2020-04-04 Jakub Jelinek PR c++/94477 * pt.c (tsubst_expr) : Clear omp_parallel_combined_clauses. * g++.dg/gomp/pr94477.C: New test. --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d0b0cb1cac5..fc3ad899a4a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-04-04 Jakub Jelinek + + PR c++/94477 + * pt.c (tsubst_expr) : Clear + omp_parallel_combined_clauses. + 2020-04-03 Jason Merrill PR c++/91966 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index b602f9f82c7..6122227c22f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18467,8 +18467,10 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aad627d84f3..494533f2a55 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-04-04 Jakub Jelinek + + PR c++/94477 + * g++.dg/gomp/pr94477.C: New test. + 2020-04-03 H.J. Lu PR target/94467 diff --git a/gcc/testsuite/g++.dg/gomp/pr94477.C b/gcc/testsuite/g++.dg/gomp/pr94477.C new file mode 100644 index 00000000000..e7fdc23d6d3 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr94477.C @@ -0,0 +1,18 @@ +// PR c++/94477 +// { dg-do compile } + +void foo (); + +template +void +bar () +{ + #pragma omp parallel master + foo (); +} + +void +baz () +{ + bar<0> (); +}