On Sat, Nov 11, 2017 at 11:03:06PM +0100, Marc Glisse wrote:
> --- gcc/tree-vrp.c (revision 254629)
> +++ gcc/tree-vrp.c (working copy)
> @@ -2086,20 +2086,38 @@ extract_range_from_binary_expr_1 (value_
> else
> set_value_range_to_varying (vr);
>
> return;
> }
>
> /* For integer ranges, apply the operation to each end of the
> range and see what we end up with. */
> if (code == PLUS_EXPR || code == MINUS_EXPR)
> {
> + /* If one argument is varying, we can sometimes still deduce a
> + range for the output: any + [3, +INF] is in [MIN+3, +INF]. */
> + if (TYPE_OVERFLOW_UNDEFINED (expr_type))
> + {
> + if(vr0.type == VR_VARYING && vr1.type == VR_RANGE)
> + {
> + vr0.type = type = VR_RANGE;
> + vr0.min = vrp_val_min (expr_type);
> + vr0.max = vrp_val_max (expr_type);
> + }
> + if(vr1.type == VR_VARYING && vr0.type == VR_RANGE)
Missing space before ( in 2 places.
Shouldn't this second if be actually else if?
> + {
> + vr1.type = VR_RANGE;
> + vr1.min = vrp_val_min (expr_type);
> + vr1.max = vrp_val_max (expr_type);
> + }
> + }
> +
Jakub