This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/49958] New: fold performs invalid association


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

           Summary: fold performs invalid association
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


extern void abort (void);
int foo (int i, int j, int o, int m) { return i*o + 1 + j*m > 1; }
int main()
{
  if (foo (- __INT_MAX__ - 1, -1, 1, 1))
    abort ();
  return 0;
}

abort()s with -fstrict-overflow even though there is no overflow
involved in INT_MIN + 1 - 1.  But fold re-associates this to
INT_MIN - 1 + 1 which overflows (it does require the two multiplications
to trigger).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]