http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55481
--- Comment #13 from rakdver at iuuk dot mff.cuni.cz 2012-11-28 16:19:11 UTC --- > now, but iv->no_overflow is false (and IVOPTs nowhere uses that flag ...). > > I can fix this for example with > > Index: tree-ssa-loop-ivopts.c > =================================================================== > --- tree-ssa-loop-ivopts.c (revision 193887) > +++ tree-ssa-loop-ivopts.c (working copy) > @@ -982,6 +982,9 @@ determine_biv_step (gimple phi) > if (!simple_iv (loop, loop, name, &iv, true)) > return NULL_TREE; > > + if (!iv.no_overflow) > + return NULL_TREE; > + > return integer_zerop (iv.step) ? NULL_TREE : iv.step; > } > > but I'm not sure what invariants should hold for BIVs and if the overflow > check should happen in a different place instead. Zdenek? Ivopts transformations are intended to work even with wrapping induction variables; so this does not seem to be the right place to fix the problem. I will have to have a closer look to see what goes wrong.