[Bug rtl-optimization/23518] New: some gcc optimizations do not take overflow into account
pterjan at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Aug 22 19:46:00 GMT 2005
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.
[pterjan@plop 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;
}
[pterjan@plop tmp]$ gcc -O0 lim.c ; ./a.out
Hello !
[pterjan@plop tmp]$ gcc -O1 lim.c ; ./a.out
[pterjan@plop 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
More information about the Gcc-bugs
mailing list