Ping.

On Wed, Mar 01, 2017 at 08:09:05PM +0100, Marek Polacek wrote:
> The following testcase ICEd with -Wduplicated-branches and -fopenmp
> because we tried to has omp_parallel expression that contained some
> TREE_VECs, but those aren't handled in inchash::add_expr.  Handling
> that is easy and fixes the ICE.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
> 
> 2017-03-01  Marek Polacek  <pola...@redhat.com>
> 
>       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.
> 
> diff --git gcc/testsuite/g++.dg/warn/Wduplicated-branches2.C 
> gcc/testsuite/g++.dg/warn/Wduplicated-branches2.C
> index 4da2d54..7e14c5f 100644
> --- gcc/testsuite/g++.dg/warn/Wduplicated-branches2.C
> +++ gcc/testsuite/g++.dg/warn/Wduplicated-branches2.C
> @@ -1,4 +1,4 @@
> -// PR c/6427
> +// PR c/64279
>  // { dg-do compile { target c++11 } }
>  // { dg-options "-Wduplicated-branches" }
>  
> diff --git gcc/testsuite/g++.dg/warn/Wduplicated-branches3.C 
> gcc/testsuite/g++.dg/warn/Wduplicated-branches3.C
> index e69de29..26dab85 100644
> --- gcc/testsuite/g++.dg/warn/Wduplicated-branches3.C
> +++ gcc/testsuite/g++.dg/warn/Wduplicated-branches3.C
> @@ -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>();
> +}
> diff --git gcc/tree.c gcc/tree.c
> index 42c8a2d..8f87e7c 100644
> --- gcc/tree.c
> +++ gcc/tree.c
> @@ -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
> 
>       Marek

        Marek

Reply via email to