public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass
@ 2023-09-05 16:42 jeremy.bennett at embecosm dot com
  2023-09-05 18:10 ` [Bug target/111295] " jeremy.bennett at embecosm dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2023-09-05 16:42 UTC (permalink / raw)
  To: gcc-bugs

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)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
@ 2023-09-05 18:10 ` jeremy.bennett at embecosm dot com
  2023-09-06  8:42 ` juzhe.zhong at rivai dot ai
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2023-09-05 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jeremy Bennett <jeremy.bennett at embecosm dot com> ---
Further analysis suggests this also causes the following SPEC CPU 2017
benchmarks to fail: 602.gcc_s, 648.exchange2_s, 607.cactuBSSN_s, 621.wrf_s,
627.cam4_s, 628.pop2_s, 638.imagick_s, 649.fotonik3d_s and 654.roms_s

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
  2023-09-05 18:10 ` [Bug target/111295] " jeremy.bennett at embecosm dot com
@ 2023-09-06  8:42 ` juzhe.zhong at rivai dot ai
  2023-09-06 10:46 ` juzhe.zhong at rivai dot ai
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-09-06  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

JuzheZhong <juzhe.zhong at rivai dot ai> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |juzhe.zhong at rivai dot ai

--- Comment #2 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
confirm

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
  2023-09-05 18:10 ` [Bug target/111295] " jeremy.bennett at embecosm dot com
  2023-09-06  8:42 ` juzhe.zhong at rivai dot ai
@ 2023-09-06 10:46 ` juzhe.zhong at rivai dot ai
  2023-09-06 11:00 ` jeremy.bennett at embecosm dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-09-06 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
This code can not be compiled:

cc1plus: warning: command-line option '-Wno-implicit-function-declaration' is
valid for C/ObjC but not for C++
bug.C: In function 'int q()':
bug.C:6:9: warning: empty parentheses were disambiguated as a function
declaration [-Wvexing-parse]
    6 |   int r ();
      |         ^~
bug.C:6:9: note: remove parentheses to default-initialize a variable
    6 |   int r ();
      |         ^~
      |         --
bug.C:25:19: error: 's' was not declared in this scope
   25 |                   s (-l, ~0);
      |                   ^
bug.C:26:19: error: 't' was not declared in this scope
   26 |                   t (j);
      |                   ^
bug.C:27:43: error: 'u' was not declared in this scope
   27 |                   d = d + (a & 10000000 ? u (r, 2) : b);
      |                                           ^
bug.C:31:13: error: 's' was not declared in this scope
   31 |         p ? s () : 0;
      |             ^
bug.C:33:1: warning: no return statement in function returning non-void
[-Wreturn-type]
   33 | }

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
                   ` (2 preceding siblings ...)
  2023-09-06 10:46 ` juzhe.zhong at rivai dot ai
@ 2023-09-06 11:00 ` jeremy.bennett at embecosm dot com
  2023-09-06 12:48 ` juzhe.zhong at rivai dot ai
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2023-09-06 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jeremy Bennett <jeremy.bennett at embecosm dot com> ---
@JuzheZhong  - it's a C test case, not C++.  Look like you are trying to
compile it as C++.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
                   ` (3 preceding siblings ...)
  2023-09-06 11:00 ` jeremy.bennett at embecosm dot com
@ 2023-09-06 12:48 ` juzhe.zhong at rivai dot ai
  2023-09-06 13:59 ` cvs-commit at gcc dot gnu.org
  2023-09-08 13:33 ` jeremy.bennett at embecosm dot com
  6 siblings, 0 replies; 8+ messages in thread
From: juzhe.zhong at rivai dot ai @ 2023-09-06 12:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from JuzheZhong <juzhe.zhong at rivai dot ai> ---
I see. A candidate patch to fix this issue:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629456.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
                   ` (4 preceding siblings ...)
  2023-09-06 12:48 ` juzhe.zhong at rivai dot ai
@ 2023-09-06 13:59 ` cvs-commit at gcc dot gnu.org
  2023-09-08 13:33 ` jeremy.bennett at embecosm dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-06 13:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pan Li <panli@gcc.gnu.org>:

https://gcc.gnu.org/g:1b4c70d4271a00514ae20970d483c3b78d9d66ef

commit r14-3743-g1b4c70d4271a00514ae20970d483c3b78d9d66ef
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Wed Sep 6 20:47:24 2023 +0800

    RISC-V: Fix VSETVL PASS AVL/VL fetch bug[111295]

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

    gcc/ChangeLog:

            PR target/111295
            * config/riscv/riscv-vsetvl.cc (insert_vsetvl): Bug fix.

    gcc/testsuite/ChangeLog:

            PR target/111295
            * gcc.target/riscv/rvv/autovec/pr111295.c: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug target/111295] RISC-V vector ICE in vsetvl pass
  2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
                   ` (5 preceding siblings ...)
  2023-09-06 13:59 ` cvs-commit at gcc dot gnu.org
@ 2023-09-08 13:33 ` jeremy.bennett at embecosm dot com
  6 siblings, 0 replies; 8+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2023-09-08 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jeremy Bennett <jeremy.bennett at embecosm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #7 from Jeremy Bennett <jeremy.bennett at embecosm dot com> ---
I can confirm this patch resolves the issue.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-08 13:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-05 16:42 [Bug middle-end/111295] New: RISC-V vector ICE in vsetvl pass jeremy.bennett at embecosm dot com
2023-09-05 18:10 ` [Bug target/111295] " jeremy.bennett at embecosm dot com
2023-09-06  8:42 ` juzhe.zhong at rivai dot ai
2023-09-06 10:46 ` juzhe.zhong at rivai dot ai
2023-09-06 11:00 ` jeremy.bennett at embecosm dot com
2023-09-06 12:48 ` juzhe.zhong at rivai dot ai
2023-09-06 13:59 ` cvs-commit at gcc dot gnu.org
2023-09-08 13:33 ` jeremy.bennett at embecosm dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).