http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46675
--- Comment #12 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-11-27 22:20:13 UTC --- (In reply to comment #11) > (In reply to comment #9) > > > > > Testcase: > > > > volatile int j; > > int __attribute__((noinline)) > > foo(int n) > > { > > int i = 0, npairs; > > npairs = n - (- __INT_MAX__ - 1); > > if (npairs > 0) > > { > > do > > { > > ++j; > > i = i + 1; > > } > > while (i < npairs); > > } > > return 0; > > } > > extern void abort (void); > > int main() > > { > > j = 0; > > foo (- __INT_MAX__ - 1 + 5); > > if (j != 5) > > abort (); > > return 0; > > } > > > > is optimized to an endless loop by the first VRP pass. > > It is caused by revision 163724: > > http://gcc.gnu.org/ml/gcc-cvs/2010-09/msg00015.html It surely has exposed it - before that patch VRP didn't use number of iteration analysis. Wheter that was correct at any point remains an open question.