re PR c++/79672 (ICE with -Wduplicated-branches -fopenmp)

PR c++/79672
	* tree.c (inchash::add_expr): Handle TREE_VEC.

	* g++.dg/warn/Wduplicated-branches2.C: Fix PR.
	* g++.dg/warn/Wduplicated-branches3.C: New test.

From-SVN: r245996
This commit is contained in:
Marek Polacek 2017-03-09 09:53:03 +00:00 committed by Marek Polacek
parent f084a22e98
commit 410a590c2a
5 changed files with 34 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2017-03-09 Marek Polacek <polacek@redhat.com>
PR c++/79672
* tree.c (inchash::add_expr): Handle TREE_VEC.
2017-03-09 Martin Liska <mliska@suse.cz>
PR ipa/79764

View File

@ -1,3 +1,9 @@
2017-03-09 Marek Polacek <polacek@redhat.com>
PR c++/79672
* g++.dg/warn/Wduplicated-branches2.C: Fix PR.
* g++.dg/warn/Wduplicated-branches3.C: New test.
2017-03-09 Prachi Godbole <prachi.godbole@imgtec.com>
* gcc.target/mips/msa-bclri.c: Skip the test for -O0.

View File

@ -1,4 +1,4 @@
// PR c/6427
// PR c/64279
// { dg-do compile { target c++11 } }
// { dg-options "-Wduplicated-branches" }

View File

@ -0,0 +1,18 @@
// PR c++/79672
// { dg-do compile }
// { dg-options "-Wduplicated-branches -fopenmp" }
// { dg-require-effective-target fopenmp }
template<int N> void foo()
{
if (N > 0)
{
#pragma omp parallel for
for (int i = 0; i < 10; ++i) ;
}
}
void bar()
{
foo<0>();
}

View File

@ -7865,6 +7865,10 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags)
inchash::add_expr (tsi_stmt (i), hstate, flags);
return;
}
case TREE_VEC:
for (int i = 0; i < TREE_VEC_LENGTH (t); ++i)
inchash::add_expr (TREE_VEC_ELT (t, i), hstate, flags);
return;
case FUNCTION_DECL:
/* When referring to a built-in FUNCTION_DECL, use the __builtin__ form.
Otherwise nodes that compare equal according to operand_equal_p might