[Bug rtl-optimization/65383] New: wrong code at -O2 and -O3 on x86_64-linux
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Tue Mar 10 23:54:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65383
Bug ID: 65383
Summary: wrong code at -O2 and -O3 on x86_64-linux
Product: gcc
Version: 5.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 mis-compiles the following code on x86_64-linux at -O2
and -O3 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/5.0.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 5.0.0 20150310 (experimental) [trunk revision 221299] (GCC)
$
$ gcc-trunk -Os small.c; ./a.out
0
$ gcc-4.6.4 -O2 small.c; ./a.out
0
$
$ gcc-trunk -O2 small.c
$ ./a.out
Segmentation fault (core dumped)
$
---------------------------------
int printf (const char *, ...);
int a, b, c;
int
fn1 ()
{
for (; a < 1; )
{
int d[10] = { 0 };
if (((b < 2) < 1) < 1)
return 0;
c = d[3000];
}
return 0;
}
int
main ()
{
fn1 ();
printf ("%d\n", 0);
return 0;
}
More information about the Gcc-bugs
mailing list