This has been tested on 3.3.6, 3.4.1 and 4.0.1 The following test is considered always false and the block is dropped but "a" being "int", (a + 1 < 0) is true.
[EMAIL PROTECTED] tmp]$ cat lim.c #include <stdio.h> #include <limits.h> int main (void) { int a = INT_MAX; if ((a < 0) || (a + 1 < 0)) { printf("Hello !\n"); } return 0; } [EMAIL PROTECTED] tmp]$ gcc -O0 lim.c ; ./a.out Hello ! [EMAIL PROTECTED] tmp]$ gcc -O1 lim.c ; ./a.out [EMAIL PROTECTED] tmp]$ -- Summary: some gcc optimizations do not take overflow into account Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pterjan at gmail dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23518