https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119712
Bug ID: 119712
Summary: compiler hang at -O{1,2,3,s} since 14.1
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: chopra.kavya04 at gmail dot com
Target Milestone: ---
The compiler seems to hang and not produce an executable for this for -O1 and
above. This has been there since v 14.1.
Godbolt link: https://godbolt.org/z/dbqWh15do
kchopra@su-lee:/local/home/kchopra$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/local/home/kchopra/.gcclocal/libexec/gcc/x86_64-pc-linux-gnu/15.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --prefix=/local/home/kchopra/.gcclocal/
--with-local-prefix=/local/home/kchopra/.gcclocal/
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.1 20250404 (experimental) (GCC)
kchopra@su-lee:/local/home/kchopra$ timeout 5 gcc -o hang hang.c
kchopra@su-lee:/local/home/kchopra$ ./hang
kchopra@su-lee:/local/home/kchopra$ rm -f hang
kchopra@su-lee:/local/home/kchopra$ timeout 5 gcc -o hang -O3 hang.c
kchopra@su-lee:/local/home/kchopra$ ./hang
-bash: ./hang: No such file or directory
kchopra@su-lee:/local/home/kchopra$ cat hang.c
int a, b, c, d, e, f;
int main() {
f--;
goto q;
j:
if (-1642776935 * c + 7 >= 0)
goto l;
m:
if (4 * a - c - 21 >= 0)
goto i;
return 0;
i:
if (d)
goto l;
q:
c = 4 * c - 3;
if (c - f)
goto m;
goto j;
l:
e = b + 1958960196 * c - 1016458303;
if (20 * e + 1 >= 0)
return 0;
goto j;
}