https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115782
Bug ID: 115782
Summary: ICE on valid code at -O{2,3} with
"-fno-guess-branch-probability -fgcse-sm
-fno-expensive-optimizations -fno-gcse" on
x86_64-linux-gnu: in possibly_queue_changes, at
rtl-ssa/changes.cc:378
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-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 as it doesn't reproduce with 14.1 and
earlier.
Compiler Explorer: https://godbolt.org/z/W788sGaq8
[518] % 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/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20240704 (experimental) (GCC)
[519] %
[519] % gcctk -O2 small.c; ./a.out
[520] %
[520] % gcctk -O2 -fno-guess-branch-probability -fgcse-sm
-fno-expensive-optimizations -fno-gcse small.c
during RTL pass: late_combine
small.c: In function ‘main’:
small.c:20:1: internal compiler error: in possibly_queue_changes, at
rtl-ssa/changes.cc:378
20 | }
| ^
0x248df42 internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:491
0xa43fae fancy_abort(char const*, int, char const*)
../../gcc-trunk/gcc/diagnostic.cc:1725
0xa2e25f rtl_ssa::function_info::possibly_queue_changes(rtl_ssa::insn_change&)
../../gcc-trunk/gcc/rtl-ssa/changes.cc:378
0x238b00e
rtl_ssa::function_info::change_insns(array_slice<rtl_ssa::insn_change*>)
../../gcc-trunk/gcc/rtl-ssa/changes.cc:779
0x233014a run
../../gcc-trunk/gcc/late-combine.cc:452
0x233014a combine_into_uses
../../gcc-trunk/gcc/late-combine.cc:683
0x2330897 execute
../../gcc-trunk/gcc/late-combine.cc:711
0x2330897 execute
../../gcc-trunk/gcc/late-combine.cc:760
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[521] %
[521] % cat small.c
int printf(const char *, ...);
int a, b, c, d, e, f, g, i, j, m, h;
long k, l, n, o;
int main() {
int p = e, r = i << a, q = r & b;
k = 4073709551613;
l = m = c = -(c >> j);
d = g ^ h ^ 4073709551613;
n = q - h;
o = ~d;
f = c * 4073709551613 / 409725 ^ r;
if ((n && m) || (q && j) || a)
return 0;
d = o | p;
if (g)
printf("0");
d = p;
c++;
return 0;
}