This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/34454] New: [4.3 regression] Overflow check is optimized away when -O2 is enabled
- From: "ismail at pardus dot org dot tr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2007 19:32:53 -0000
- Subject: [Bug middle-end/34454] New: [4.3 regression] Overflow check is optimized away when -O2 is enabled
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Testcase :
#include <sys/types.h>
#include <stdio.h>
void foo(ssize_t x)
{
if (x >= 0) {
if (x+x < 0) printf("Overflow\n");
}
}
main()
{
volatile ssize_t x =2147483647;
foo(x);
}
When compiled with -O2 it doesn't print Overflow, if you omit -O2 it prints
overflow.
gcc 3.4.6 works fine so this is a regression.
--
Summary: [4.3 regression] Overflow check is optimized away when -
O2 is enabled
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ismail at pardus dot org dot tr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34454