+2016-01-12 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/68911
+ * tree-vrp.c (adjust_range_with_scev): Check overflow in range
+ information computed for expression "init + nit * step".
+
2016-01-12 Sandra Loosemore <sandra@codesourcery.com>
* doc/invoke.texi (Invoking GCC): Copy-edit. Incorporate information
+2016-01-12 Bin Cheng <bin.cheng@arm.com>
+
+ PR tree-optimization/68911
+ * gcc.c-torture/execute/pr68911.c: New test.
+
2016-01-12 Marek Polacek <polacek@redhat.com>
PR c++/68979
/* Likewise if the addition did. */
if (maxvr.type == VR_RANGE)
{
+ value_range initvr = VR_INITIALIZER;
+
+ if (TREE_CODE (init) == SSA_NAME)
+ initvr = *(get_value_range (init));
+ else if (is_gimple_min_invariant (init))
+ set_value_range_to_value (&initvr, init, NULL);
+ else
+ return;
+
+ /* Check if init + nit * step overflows. Though we checked
+ scev {init, step}_loop doesn't wrap, it is not enough
+ because the loop may exit immediately. Overflow could
+ happen in the plus expression in this case. */
+ if ((dir == EV_DIR_DECREASES
+ && (is_negative_overflow_infinity (maxvr.min)
+ || compare_values (maxvr.min, initvr.min) != -1))
+ || (dir == EV_DIR_GROWS
+ && (is_positive_overflow_infinity (maxvr.max)
+ || compare_values (maxvr.max, initvr.max) != 1)))
+ return;
+
tmin = maxvr.min;
tmax = maxvr.max;
}