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
This commit is contained in:
Jakub Jelinek 2016-07-21 09:02:04 +02:00 committed by Jakub Jelinek
parent 172f0e1311
commit ee78cbaa89
4 changed files with 42 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 ();
}