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

            Bug ID: 118562
           Summary: SEGV in late-combine
                    (rtl_ssa::function_info::remove_use)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anton at ozlabs dot org
  Target Milestone: ---

The following (creduced) testcase:

float b[2], c[2];
void d();
int e() {
  int f, g;
  float *h;
  for (f = 0; f < 4; f++) {
    g = e();
    if (g)
      d();
  }
  for (g = 0; g < 4; g++) {
    c[0] = h[0] - b[0];
    c[1] = h[1] - b[1];
    d();
    h += 1;
  }
}

when built with:

riscv64-unknown-linux-gnu-gcc -O2 -march=rv64gv -c testcase.c

Hits a SEGV:

#0  rtl_ssa::function_info::remove_use (this=this@entry=0x4b22110,
use=0x4ac0a80)
    at source/gcc/gcc/rtl-ssa/accesses.cc:1276
#1  0x0000000002ec59e4 in rtl_ssa::function_info::change_insns (this=<optimized
out>, changes=...)
    at source/gcc/gcc/rtl-ssa/changes.cc:749
#2  0x0000000002e6b47f in (anonymous namespace)::insn_combination::run
(this=0x7fffffffe1c0)
    at source/gcc/gcc/late-combine.cc:453
#3  (anonymous namespace)::late_combine::combine_into_uses
(this=0x7fffffffe290, insn=<optimized out>,
    cursor=0x4abe7f8) at source/gcc/gcc/late-combine.cc:684
#4  0x0000000002e6bbd6 in (anonymous namespace)::late_combine::execute
(fn=<optimized out>, this=0x7fffffffe290)
    at source/gcc/gcc/late-combine.cc:712
#5  (anonymous namespace)::pass_late_combine::execute (this=<optimized out>,
fn=<optimized out>)
    at source/gcc/gcc/late-combine.cc:765
#6  0x00000000012f53d2 in execute_one_pass (pass=0x495d120)
    at source/gcc/gcc/passes.cc:2659

Compiler details:

Using built-in specs.
COLLECT_GCC=toolchain/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=toolchain/libexec/gcc/riscv64-unknown-linux-gnu/15.0.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: source/gcc/configure --target=riscv64-unknown-linux-gnu
--prefix=toolchain --with-sysroot=toolchain/sysroot --disable-nls
--disable-shared --disable-multilib --disable-threads --disable-libatomic
--disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv
--disable-bootstrap CFLAGS='-g -O'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 15.0.1 20250120 (experimental) (GCC)

Reply via email to