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

            Bug ID: 111295
           Summary: RISC-V vector ICE in vsetvl pass
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jeremy.bennett at embecosm dot com
  Target Milestone: ---

Created attachment 55843
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55843&action=edit
Test case

The following issue was identified while attempting to compile SPEC CPU 2017
600.perlbench_s benchmark.

Reproducer (test.c):

int a, b, c, e, f, g, h, i, j, k;
long l;
int q ()
{
  int r ();
  char *o, *d;
  _Bool p = f;
  while (g)
    {
      int m, n;
      for (; m <= n; m++)
        *d++ = m;
      k = 1;
      if (e)
        break;
      switch (*o)
        {
        case 'N':
          o++;
          if (c)
            if (h)
              while (i)
                {
                  s (-l, ~0);
                  t (j);
                  d = d + (a & 10000000 ? u (r, 2) : b);
                }
        }
      if (*o)
        p ? s () : 0;
    }
}

This is compiled with:

riscv64-unknown-linux-gnu-gcc -march=rv64gcv -mabi=lp64d -c \
    -Wno-implicit-function-declaration -Ofast \
    -ftree-vectorize --param=riscv-autovec-preference=scalable test.c

The output is:

during RTL pass: vsetvl
test.c: In function 'q':
test.c:32:1: internal compiler error: Segmentation fault
   32 | }
      | ^
0x10db7d3 crash_signal
        /home/jeremy/gittrees/mustang/gcc/gcc/toplev.cc:314
0x7fc85743c4af ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x1548f8a riscv_vector::vector_insn_info::get_avl_reg_rtx() const
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.h:339
0x1548f8a insert_vsetvl
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:750
0x1549a5d pass_vsetvl::commit_vsetvls()
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:3642
0x1549d11 pass_vsetvl::pre_vsetvl()
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:3755
0x154b988 pass_vsetvl::lazy_vsetvl()
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:4442
0x154ba91 pass_vsetvl::execute(function*)
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:4477
0x154ba91 pass_vsetvl::execute(function*)
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:4458
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.

System information
------------------

Using built-in specs.
COLLECT_GCC=riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/jeremy/gittrees/mustang/install/libexec/gcc/riscv64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /home/jeremy/gittrees/mustang/gcc/configure
--target=riscv64-unknown-linux-gnu
--prefix=/home/jeremy/gittrees/mustang/install
--with-sysroot=/home/jeremy/gittrees/mustang/install/sysroot
--with-pkgversion=g8451fbd5687 --with-system-zlib --enable-shared --enable-tls
--enable-languages=c,c++,fortran --disable-libmudflap --disable-libssp
--disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootstrap
--src=/home/jeremy/gittrees/mustang/gcc --enable-multilib --with-abi=lp64d
--with-arch=rv64gc --with-tune= --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-O2
   -mcmodel=medany' 'CXXFLAGS_FOR_TARGET=-O2    -mcmodel=medany'
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230904 (experimental) (g8451fbd5687)

Reply via email to