+2018-11-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/88217
+ * vr-values.c (vr_values::extract_range_from_phi_node): Make
+ sure to handle results > +INF and < -INF correctly when
+ trying to drop down to +INF - 1 or -INF + 1.
+
2018-11-28 Alan Modra <amodra@gmail.com>
* xcoffout.c (do_block): Signed/unsigned warning fix.
+2018-11-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/88217
+ * g++.dg/pr88217.C: New testcase.
+
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/79351
--- /dev/null
+// { dg-do compile { target c++11 } }
+// { dg-options "-O2 -fstrict-enums -fno-tree-forwprop -fno-tree-fre" }
+
+extern "C" int printf (const char *, ...);
+
+enum E { e1, e2, e3, X };
+E operator*(E e) { return e; }
+E begin(E e) { return e; }
+E end(E e) { return X; }
+E operator++(E& e) { return e = E(e+1); }
+
+int main()
+{
+ for (auto e: e1)
+ {
+ printf ("%d ", e);
+ }
+}
if (cmp_min < 0)
new_min = lhs_vr->min ();
else if (cmp_min > 0
- && !vrp_val_is_min (vr_result->min ()))
+ && tree_int_cst_lt (vrp_val_min (vr_result->type ()),
+ vr_result->min ()))
new_min = int_const_binop (PLUS_EXPR,
vrp_val_min (vr_result->type ()),
build_int_cst (vr_result->type (), 1));
if (cmp_max > 0)
new_max = lhs_vr->max ();
else if (cmp_max < 0
- && !vrp_val_is_max (vr_result->max ()))
+ && tree_int_cst_lt (vr_result->max (),
+ vrp_val_max (vr_result->type ())))
new_max = int_const_binop (MINUS_EXPR,
vrp_val_max (vr_result->type ()),
build_int_cst (vr_result->type (), 1));