[Bug middle-end/81464] [8 Regression] ICE in expand_omp_for_static_chunk, at omp-expand.c:4236

vries at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 18 08:28:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81464

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #3)
> Tentative patch:
> ...
> diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
> index 929c530..089bffc 100644
> --- a/gcc/omp-expand.c
> +++ b/gcc/omp-expand.c
> @@ -4206,6 +4206,10 @@ expand_omp_for_static_chunk (struct omp_region
> *region,
>           source_location locus;
>  
>           phi = psi.phi ();
> +         if (operand_equal_p (gimple_phi_arg_def (phi, 0),
> +                              gimple_phi_arg_def (phi, 1), 0))
> +             continue;
> +
>           t = gimple_phi_result (phi);
>           gcc_assert (t == redirect_edge_var_map_result (vm));
>  
> ...

As it turns out, at the point of the operand_equal_p test, we already lost the
second argument of the phi.

I thought that this would trigger an assert, but apparently we don't have this:
...
@@ -4379,6 +4379,7 @@ phi_nodes_ptr (basic_block bb)
 static inline tree
 gimple_phi_arg_def (gimple *gs, size_t index)
 {
+  gcc_gimple_checking_assert (index < gimple_phi_num_args(gs));
   return gimple_phi_arg (gs, index)->def;
 }

...

Using redirect_edge_var_map_def instead fixes this.


More information about the Gcc-bugs mailing list