https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119815
Bug ID: 119815 Summary: [14/15 regression] wrong code at -O{1,2,3} Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chopra.kavya04 at gmail dot com Target Milestone: --- program generates the wrong code at [14/15] for -O{1,2,3}. Godbolt link: https://godbolt.org/z/aG4o6P9sj kchopra@ast-epyc5:~/gcc_bugs$ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/local/home/kchopra/compilers/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/compilers/ --with-local-prefix=/local/home/kchopra/compilers/ Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 15.0.1 20250408 (experimental) (GCC) kchopra@ast-epyc5:~/gcc_bugs$ gcc -O0 bug.c ; ./a.out kchopra@ast-epyc5:~/gcc_bugs$ gcc -O3 -fno-tree-slsr bug.c ; ./a.out Aborted kchopra@ast-epyc5:~/gcc_bugs$ cat bug.c int a = 42; int b = -31; int c = 64; int d = -23; int e ; int main() { b = 7 * b + 7 * a -6369335; d = 9 * d + 2 * b -524132189; goto f; g: b = -2 * c -7181144; d = a -2000682747; if (d >= 0) goto h; goto i; j: b = 6 * b -2 * c + 1246173489; c = -5 * a -5 * c + 719474; i: b = -e -b -58934776; e = a + e + 1416477846; if (-8 * b -e -212600684 >= 0) goto k; goto g; f: e = -d + 4 * c -1752022944; goto j; k: a = 9 * a + b + 218090558; if (c -227893274 >= 0) goto f; h: if(a != -33550920) __builtin_abort(); }