This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/77855] New: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)
- From: "su at cs dot ucdavis.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 05 Oct 2016 01:50:42 +0000
- Subject: [Bug rtl-optimization/77855] New: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77855
Bug ID: 77855
Summary: wrong code at -O3 on x86_64-linux-gnu (in both 32-bit
and 64-bit modes)
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
It is a regression from 6.2.x.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20161004 (experimental) [trunk revision 240755] (GCC)
$
$ gcc-6.2 -O3 small.c; ./a.out
2
$ gcc-trunk -O2 small.c; ./a.out
2
$
$ gcc-trunk -O3 small.c; ./a.out
0
$
--------------------------------------------------
int a, b = 1, c, e, f, g, k, m, n, o;
char d, h, i, j, l;
void fn1 ()
{
if (e)
j = 1;
if (f)
L1:
k = j | (a & l);
for (;;)
{
__builtin_printf ("%d\n", d);
if (d)
break;
for (; o; o--)
for (; n;)
for (; m; m++)
;
goto L1;
}
}
void fn2 ()
{
d = 2;
}
void fn3 ()
{
for (;;)
{
for (; b; b--)
{
fn2 (8);
fn1 ();
}
g = h;
c = i;
break;
}
}
int main ()
{
fn3 ();
return 0;
}