https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103079
Bug ID: 103079
Summary: wrong code at -Os and -O2 on x86_64-linux-gnu (the
generated code hangs)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
This appears to be a recent regression (from GCC 11.2).
[602] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20211104 (experimental) [master r12-4879-g3fd0723f0a3] (GCC)
[603] %
[603] % gcctk -O1 small.c; ./a.out
[604] %
[604] % gcctk -Os small.c
[605] % timeout -s 9 10 ./a.out
Killed
[606] %
[606] % cat small.c
int a, b = -2;
static int c() {
if (b)
return b;
}
int main() {
int d = 0;
if (c()) {
if (!a)
d = b;
while (d > -1)
;
}
return 0;
}