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: unassig...@gcc.gnu.org ReportedBy: rgue...@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).