This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/49958] New: fold performs invalid association
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 3 Aug 2011 11:31:18 +0000
- Subject: [Bug middle-end/49958] New: fold performs invalid association
- Auto-submitted: auto-generated
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).