[Bug c/48717] New: likely integer wrong code bug
regehr at cs dot utah.edu
gcc-bugzilla@gcc.gnu.org
Thu Apr 21 21:42:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48717
Summary: likely integer wrong code bug
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: regehr@cs.utah.edu
[regehr@gamow tmp012]$ current-gcc -O1 small.c -o small
[regehr@gamow tmp012]$ ./small
65535
[regehr@gamow tmp012]$ current-gcc -O2 small.c -o small
[regehr@gamow tmp012]$ ./small
-1
[regehr@gamow tmp012]$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r172845-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.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-r172845-install
--program-prefix=r172845- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20110421 (experimental) (GCC)
[regehr@gamow tmp012]$ cat small.c
unsigned short safe_52 (unsigned short ui1, unsigned short ui2)
{
return ui1 + ui2;
}
extern int printf (const char *, ...);
int g_7 = 1;
int g_8;
void func_1 (void)
{
g_7 = safe_52 (~g_8, g_8);
}
int main (void)
{
func_1 ();
printf ("%d\n", g_7);
return 0;
}
More information about the Gcc-bugs
mailing list