[Bug tree-optimization/59715] New: wrong code at -Os and above on x86_64-linux-gnu
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Wed Jan 8 06:37:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59715
Bug ID: 59715
Summary: wrong code at -Os and above on x86_64-linux-gnu
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
The current gcc trunk (as well as 4.8.x and 4.7.x) miscompiles the following
code on x86_64-linux at -Os and above in both 32-bit and 64-bit modes.
This is a regression from 4.6.x.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20140107 (experimental) [trunk revision 206387] (GCC)
$
$ gcc-trunk -O1 small.c; a.out
0
$ gcc-4.6 -Os small.c; a.out
0
$ gcc-trunk -Os small.c; a.out
2
$ gcc-4.8 -Os small.c; a.out
2
$ gcc-4.7 -Os small.c; a.out
2
$
----------------------------------
int printf (const char *, ...);
int a = 2, b;
int
main ()
{
int c;
if (!b)
{
b = a;
c = a == 0 ? 1 : 1 % a;
if (c)
b = 0;
}
printf ("%d\n", b);
return 0;
}
More information about the Gcc-bugs
mailing list