+2009-04-24 Richard Guenther <rguenther@suse.de>
+
+ * tree-vrp.c (extract_range_from_binary_expr): Handle overflow
+ from unsigned additions.
+
2009-04-24 Joseph Myers <joseph@codesourcery.com>
* c-typeck.c (set_init_index): Allow array designators that are
+2009-04-24 Richard Guenther <rguenther@suse.de>
+
+ * gcc.dg/tree-ssa/vrp48.c: New testcase.
+
2009-04-24 Joseph Myers <joseph@codesourcery.com>
* gcc.dg/array-const-1.c, gcc.dg/array-const-2.c,
the same end of each range. */
min = vrp_int_const_binop (code, vr0.min, vr1.min);
max = vrp_int_const_binop (code, vr0.max, vr1.max);
+
+ /* If both additions overflowed the range kind is still correct.
+ This happens regularly with subtracting something in unsigned
+ arithmetic.
+ ??? See PR30318 for all the cases we do not handle. */
+ if (code == PLUS_EXPR
+ && (TREE_OVERFLOW (min) && !is_overflow_infinity (min))
+ && (TREE_OVERFLOW (max) && !is_overflow_infinity (max)))
+ {
+ min = build_int_cst_wide (TREE_TYPE (min),
+ TREE_INT_CST_LOW (min),
+ TREE_INT_CST_HIGH (min));
+ max = build_int_cst_wide (TREE_TYPE (max),
+ TREE_INT_CST_LOW (max),
+ TREE_INT_CST_HIGH (max));
+ }
}
else if (code == MULT_EXPR
|| code == TRUNC_DIV_EXPR