http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46675
--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-27 22:06:27
UTC ---
(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