[Bug c/51342] -O2 optimization fails in gcc-4.6.2, but succeeds when -fno-inline-small-functions is added

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 29 05:03:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51342

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-11-29 04:56:13 UTC ---
  static int n = 137;
  while ((n = n * 1103515245 + 12345) < 0);
  return n;

You are checking for overflow which is undefined for signed integers in C.  So
your testcase is invalid and undefined.



More information about the Gcc-bugs mailing list