https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61452
Bug ID: 61452
Summary: hang at -O1 and -Os on x86_64-linux-gnu
Product: gcc
Version: 4.10.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 following (valid) code causes gcc trunk (as well gcc 4.8 and 4.9) to hang
at -O1 and -Os (but not at -O0, -O2, and -O3).
This is a regression from 4.7.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.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 20140608 (experimental) [trunk revision 211353] (GCC)
$
$ gcc-trunk -O0 small.c; a.out
$ gcc-trunk -O2 small.c; a.out
$ gcc-4.7.3 -O1 small.c; a.out
$ gcc-4.7.3 -Os small.c; a.out
$
$ timeout -s 9 30 gcc-trunk -O1 small.c
Killed
$
----------------------------
int a, b;
short c, d;
char e, f;
int
fn1 (int p1, char p2)
{
return p1 || p2 ? 0 : p2;
}
void
fn2 ()
{
for (; a;)
{
int g;
g = c = e;
for (; a;)
b = fn1 (g = d = e, g);
f = g;
}
}
int
main ()
{
fn2 ();
return 0;
}