http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47155
Summary: likely wrong code bug
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
[reg...@gamow tmp438]$ current-gcc -O0 small.c -o small
[reg...@gamow tmp438]$ ./small
1
[reg...@gamow tmp438]$ current-gcc -O1 small.c -o small
[reg...@gamow tmp438]$ ./small
0
[reg...@gamow tmp438]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r168402-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r168402-install
--program-prefix=r168402- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20110102 (experimental) (GCC)
[reg...@gamow tmp438]$ cat small.c
static unsigned int g_1;
static signed char g_2 = 0x81;
int printf(const char *format, ...);
static unsigned char foo(unsigned char p1, unsigned char p2)
{
return p1 * p2;
}
int main (void)
{
int l_5[2];
int i;
for (i = 0; i < 2; i++)
l_5[i] = 1;
g_1 = g_2 <= foo(-6, l_5[0]);
printf("%u\n", g_1);
return 0;
}