https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115782

--- Comment #2 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Compiler Explorer: https://godbolt.org/z/MeKeYYjYq

Another reproducer for -O{2,3} without any other flags:

[550] % 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 20240711 (experimental) (GCC)
[551] %
[551] % gcctk -O2 small.c
during RTL pass: late_combine
small.c: In function ‘main’:
small.c:31:1: internal compiler error: in possibly_queue_changes, at
rtl-ssa/changes.cc:378
   31 | }
      | ^
0x2496472 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:491
0xa452f4 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1725
0xa2f3f3 rtl_ssa::function_info::possibly_queue_changes(rtl_ssa::insn_change&)
        ../../gcc-trunk/gcc/rtl-ssa/changes.cc:378
0x2393115
rtl_ssa::function_info::change_insns(array_slice<rtl_ssa::insn_change*>)
        ../../gcc-trunk/gcc/rtl-ssa/changes.cc:779
0x233824a run
        ../../gcc-trunk/gcc/late-combine.cc:452
0x233824a combine_into_uses
        ../../gcc-trunk/gcc/late-combine.cc:683
0x2338997 execute
        ../../gcc-trunk/gcc/late-combine.cc:711
0x2338997 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.
[552] %
[552] % cat small.c
int a, b, c, d, e, f;
int main() {
  int g, i = 4, j = 5;
  char h = 4;
  if (c) {
    j = 0;
    i = ~(d * 6);
    if (a)
      goto k;
  }
  g = e;
  while (a) {
    long l;
    while (b) {
      int m = ~g;
    o:
      l = m;
      char n;
      int q, p = h;
    k:
      h = h % l - (-1 % q & (i || a));
      f = (f & p - l % n << h) % b;
      if (j)
        continue;
      h = n;
      if (f)
        goto o;
    }
  }
  return 0;
}

Reply via email to