aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-07-21 09:02:04 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-07-21 09:02:04 +0200
commitee78cbaa8956684189f8fe3ca2b4fcac7d48df91 (patch)
treece352f34041577c4315dbf84fa043735176fe814
parent172f0e1311f23be40aeb4816f77793dc1317612d (diff)
downloadgcc-ee78cbaa8956684189f8fe3ca2b4fcac7d48df91.zip
gcc-ee78cbaa8956684189f8fe3ca2b4fcac7d48df91.tar.gz
gcc-ee78cbaa8956684189f8fe3ca2b4fcac7d48df91.tar.bz2
re PR libgomp/71941 (ICE with OpenMP tasks and queue)
PR c++/71941 * cp-gimplify.c (cp_genericize): For nested cp_genericize calls save/restore bc_label array. * g++.dg/gomp/pr71941.C: New test. From-SVN: r238579
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-gimplify.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr71941.C22
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2e8877f..30a0b44 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/71941
+ * cp-gimplify.c (cp_genericize): For nested cp_genericize calls
+ save/restore bc_label array.
+
2016-07-21 Jason Merrill <jason@redhat.com>
PR c++/70781
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index ee28ba5..59953a6 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -1632,6 +1632,13 @@ cp_genericize (tree fndecl)
if (DECL_CLONED_FUNCTION_P (fndecl))
return;
+ /* Allow cp_genericize calls to be nested. */
+ tree save_bc_label[2];
+ save_bc_label[bc_break] = bc_label[bc_break];
+ save_bc_label[bc_continue] = bc_label[bc_continue];
+ bc_label[bc_break] = NULL_TREE;
+ bc_label[bc_continue] = NULL_TREE;
+
/* Expand all the array notations here. */
if (flag_cilkplus
&& contains_array_notation_expr (DECL_SAVED_TREE (fndecl)))
@@ -1651,6 +1658,8 @@ cp_genericize (tree fndecl)
gcc_assert (bc_label[bc_break] == NULL);
gcc_assert (bc_label[bc_continue] == NULL);
+ bc_label[bc_break] = save_bc_label[bc_break];
+ bc_label[bc_continue] = save_bc_label[bc_continue];
}
/* Build code to apply FN to each member of ARG1 and ARG2. FN may be
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 004cb58..48f7baf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-21 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/71941
+ * g++.dg/gomp/pr71941.C: New test.
+
2016-07-20 David Malcolm <dmalcolm@redhat.com>
PR c/70339
diff --git a/gcc/testsuite/g++.dg/gomp/pr71941.C b/gcc/testsuite/g++.dg/gomp/pr71941.C
new file mode 100644
index 0000000..ffa53d0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr71941.C
@@ -0,0 +1,22 @@
+// PR c++/71941
+// { dg-do compile }
+// { dg-options "-fopenmp" }
+
+struct A { A (); A (A &); ~A (); };
+
+template <int N>
+struct B
+{
+ struct C { A a; C () : a () {} };
+ C c;
+ void foo ();
+};
+
+void
+bar ()
+{
+ B<0> b;
+#pragma omp task
+ for (int i = 0; i < 2; i++)
+ b.foo ();
+}