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

            Bug ID: 115928
           Summary: ICE on valid code at -O2 with "-fgcse-sm" on
                    x86_64-linux-gnu: in merge_clobber_groups, at
                    rtl-ssa/accesses.cc:757
           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: ---

It appears to be a recent regression as it doesn't reproduce with 14.1 and
earlier. 

Compiler Explorer: https://godbolt.org/z/87jKGxq6E

[520] % 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 20240714 (experimental) (GCC) 
[521] % 
[521] % gcctk -O2 -fgcse-sm small.c
during RTL pass: late_combine
small.c: In function ‘main’:
small.c:21:1: internal compiler error: in merge_clobber_groups, at
rtl-ssa/accesses.cc:757
   21 | }
      | ^
0x24979f5 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:491
0xa462c6 fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1725
0xa3015f rtl_ssa::function_info::merge_clobber_groups(rtl_ssa::clobber_info*,
rtl_ssa::clobber_info*, rtl_ssa::def_info*)
        ../../gcc-trunk/gcc/rtl-ssa/accesses.cc:757
0x238ea90 rtl_ssa::function_info::remove_def(rtl_ssa::def_info*)
        ../../gcc-trunk/gcc/rtl-ssa/accesses.cc:1040
0x2394cb1
rtl_ssa::function_info::change_insns(array_slice<rtl_ssa::insn_change*>)
        ../../gcc-trunk/gcc/rtl-ssa/changes.cc:852
0x233966a run
        ../../gcc-trunk/gcc/late-combine.cc:452
0x233966a combine_into_uses
        ../../gcc-trunk/gcc/late-combine.cc:683
0x2339db7 execute
        ../../gcc-trunk/gcc/late-combine.cc:711
0x2339db7 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.
[522] % 
[522] % cat small.c
int a[1], b, c;
struct {
  int d;
  int e;
  int : 8;
} f[1];
static int g;
char h, i, j;
void k(int l) { b = 5 ^ a[b ^ (l & 5)]; }
void m(long l) { k(c >> 6); }
int main() {
  g++;
  if (b) {
    h = 5 && j;
    if (h)
      h -= i;
    m(f[g].d);
    m(f[g].e);
  }
  return 0;
}

Reply via email to