[patch] Fix PR lto/50492

Eric Botcazou ebotcazou@adacore.com
Fri Oct 7 12:02:00 GMT 2011


> Hm, but canonicalize_cond_expr_cond is supposed to produce a
> tree that is suitable for a condition in a GIMPLE_COND, or a
> COND_EXPR.  So the issue is that it is used for a tcc_comparison
> on a assignment RHS?

It is called on (Ada_Boolean_Type) iftmp.xxx, which comes from the RHS of

  Ada_Boolean_Var = (Integer_Var != 0);

> Wouldn't the "proper" fix then be to verify that the result from
> forward_propagate_into_comparison_1 in forwprop is a suitable
> replacement of the assign rhs in forward_propagate_into_comparison?

Not clear whether it is the proper fix, as you explicitly pass the type in the 
call to forward_propagate_into_comparison_1 just above:

  tmp = forward_propagate_into_comparison_1 (stmt,
					     gimple_assign_rhs_code (stmt),
					     TREE_TYPE
					       (gimple_assign_lhs (stmt)),
					     rhs1, rhs2);

and then to combine_cond_expr_cond, so you would expect that both functions 
return a tree with the specified type.  But this would probably work, yes.

-- 
Eric Botcazou



More information about the Gcc-patches mailing list