[Bug optimization/11068] New: GCC 3.2.X miscompiles Firebird 1.5 with -O1
skidder@bssys.com
gcc-bugzilla@gcc.gnu.org
Mon Jun 2 20:52:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11068
Summary: GCC 3.2.X miscompiles Firebird 1.5 with -O1
Product: gcc
Version: 3.2.2
Status: UNCONFIRMED
Severity: blocker
Priority: P4
Component: optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: skidder@bssys.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu
Problem is reproducable using GCC 3.2.1 or 3.2.3 on
Mandrake 8.0 with GLIBC 2.3.1
Here is the testcase:
=== test.cpp =====================
#include <stdio.h>
#define USHORT unsigned short
#define UCHAR unsigned char
USHORT get_numeric() {
return 42388;
}
int main ()
{
USHORT length, l;
UCHAR *buffer, static_buffer [1024];
length = (USHORT)get_numeric();
/* Allocate blob buffer is static buffer is too short */
if (!length || length + 1 <= (USHORT)(sizeof (static_buffer)) ) {
buffer = static_buffer;
printf("Shit happened !");
}
else
{
printf("Works fine");
l = length + 1;
// buffer = BURP_ALLOC (l);
return 1;
}
}
========================
g++ test.cpp
./a.out
Works fine
========================
g++ -O1 test.cpp
./a.out
Shit happened !
========================
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the Gcc-bugs
mailing list