http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61047
Bug ID: 61047
Summary: wrong code at -O1 on x86_64-linux
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
The current gcc trunk and 4.9.0 mis-compile the following code on x86_64-linux
at -O1 in both 32-bit and 64-bit modes.
This is a regression from 4.8.x and seems related to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60452.
$ 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.10.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.10.0 20140503 (experimental) [trunk revision 210026] (GCC)
$
$ gcc-trunk -O0 small.c; a.out
$ gcc-trunk -Os small.c; a.out
$ gcc-4.8.2 -O1 small.c; a.out
$
$ gcc-trunk -O1 small.c
$ a.out
Segmentation fault (core dumped)
$ gcc-4.9.0 -O1 small.c
$ a.out
Segmentation fault (core dumped)
$
---------------------
int a, c, d;
short b;
int
main ()
{
int e[1];
for (; b < 2; b++)
{
a = 0;
if (b == 2837)
a = e[b];
if (!(d || b))
for (; c;)
;
}
return 0;
}