+2005-09-01 Sebastian Pop <pop@cri.ensmp.fr>
+
+ PR tree-optimization/23410
+ * tree-ssa-loop-niter.c (scev_probably_wraps_p): Check that the
+ sequence is not wrapping during the first step.
+
2005-09-01 Jakub Jelinek <jakub@redhat.com>
PR debug/7241
struct nb_iter_bound *bound;
tree delta, step_abs;
tree unsigned_type, valid_niter;
- tree base_plus_step;
+ tree base_plus_step, bpsps;
+ int cps, cpsps;
/* FIXME: The following code will not be used anymore once
http://gcc.gnu.org/ml/gcc-patches/2005-06/msg02025.html is
*unknown_max = false;
base_plus_step = fold_build2 (PLUS_EXPR, type, base, step);
- switch (compare_trees (base_plus_step, base))
+ bpsps = fold_build2 (PLUS_EXPR, type, base_plus_step, step);
+ cps = compare_trees (base_plus_step, base);
+ cpsps = compare_trees (bpsps, base_plus_step);
+
+ /* Check that the sequence is not wrapping in the first step: it
+ should have the same monotonicity for the first two steps. See
+ PR23410. */
+ if (cps != cpsps)
+ return true;
+
+ switch (cps)
{
case -1:
{