[Bug tree-optimization/55883] New: with -fwrapv, (x < 0 && -x < 0) is assumed to be false

xi.wang at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Jan 5 03:57:00 GMT 2013


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

             Bug #: 55883
           Summary: with -fwrapv, (x < 0 && -x < 0) is assumed to be false
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xi.wang@gmail.com


This is slightly different from Bug 22493.

#include <limits.h>
void abort ();
void f(int i)
{
  if (i<0 && -i<0)
    return;
  abort ();
}

int main(void)
{
  f(INT_MIN);
  return 0;
}

The program should not abort if compiled with -fwrapv.  4.7.2 and 4.6.3 seem to
miscompile it.  4.8 is good.



More information about the Gcc-bugs mailing list