[Bug tree-optimization/58662] New: wrong code at -O2 and -O3 on x86_64-linux-gnu (in 64-bit mode)
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Tue Oct 8 05:27:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58662
Bug ID: 58662
Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu (in
64-bit mode)
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 miscompiles the attached testcase on x86_64-linux-gnu at
-O2 and -O3 in 64-bit mode.
It is a regression from 4.8.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
--enable-languages=c,c++,objc,obj-c++,fortran,lto --disable-werror
--enable-checking=release --with-gmp=/usr/local/gcc-trunk
--with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk
--with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20131007 (experimental) [trunk revision 203235] (GCC)
$
$ gcc-trunk -Os small.c; a.out
0
$ gcc-trunk -O2 small.c; a.out
-1008071096
$ gcc-trunk -O3 small.c; a.out
86090104
$
$ gcc-4.8 -O2 small.c; a.out
0
$ gcc-4.8 -O3 small.c; a.out
0
$
-------------------------------------
int printf (const char *, ...);
int a, b, c, d;
int
foo (int p1, short p2)
{
return p1 / p2;
}
int
main ()
{
char e;
d = foo (a == 0, (0, 35536));
e = d % 14;
b = e && c;
printf ("%d\n", b);
return 0;
}
More information about the Gcc-bugs
mailing list