public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jeremy.bennett at embecosm dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/111375] New: RISC-V vector Fortran: SEGV ICE during get_avl_or_vl_reg (vsetvl pass)
Date: Mon, 11 Sep 2023 18:21:13 +0000	[thread overview]
Message-ID: <bug-111375-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 111375
           Summary: RISC-V vector Fortran: SEGV ICE during
                    get_avl_or_vl_reg (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 55878
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55878&action=edit
Test case for the issue

Found when building SPEC CPU 2017 621.wrf_s.  The same problem appears to occur
in 627.cam4_s and 628.pop2_s

Reproducer (test.f90):

MODULE a
CONTAINS
  SUBROUTINE b(KTE)
    REAL,DIMENSION(KTE) :: c,e,f,q
    LOGICAL ae
    DO af=ag,ah
       DO i=ai,aj
          CALL ak(al,i,af,am,an,d,g,c,q,e,f,h,r       &
               ,e,f,s,ao,LTOP,ap,aq,ar,as,at,au,av,aw &
               ,ae,ax,ay,az,ba,bb,bc                  &
               ,d,be,bf,bg,bh,bi,ai,aj,ag,ah,KTS,KTE)
       ENDDO
    ENDDO
  END SUBROUTINE b
  SUBROUTINE ak(al,i,af,am,an,bj,bk                   &
       ,bl,bm,bn,t,h,u,e,f,s,ao,LTOP,ap               &
       ,aq,ar,as,at,au,av,aw,ae                       &
       ,ax,a,b,c,d,bc                                 &
       ,bd,be,bf,bg,bh,bi,ai,aj,ag,ah,KTS,KTE)
    REAL,DIMENSION(:) :: bl,bm,bn,t
    REAL,DIMENSION(:) :: e,f
    REAL,DIMENSION(KTE) :: v
    LOGICAL ae
    l : DO j=1,w
       DO k=LTOP,m
          IF(o>=p)THEN
             n=x()
          ENDIF
       ENDDO
       y : DO z=1,2
          DO k=LTOP,m
             aa=v(k)+aa
          ENDDO
          ab=aa
          DO k=KTS,m
             IF(k<=ac)ad=k
          ENDDO
          IF(LCOR<=ad)THEN
             DO k=LCOR,ad
                v=ab
             ENDDO
          ENDIF
       ENDDO  y
    ENDDO  l
  END SUBROUTINE ak
END MODULE a

Compile with:

riscv64-unknown-linux-gnu-gfortran -w -march=rv64gcv -mabi=lp64d -c -Ofast    
-ftree-vectorize --param=riscv-autovec-preference=scalable test.f90

Output is:

during RTL pass: vsetvl
test.f90:14:18:

   14 |   END SUBROUTINE b
      |                  ^
internal compiler error: in get_avl_or_vl_reg, at
config/riscv/riscv-vsetvl.cc:2297
0x98b1e3 riscv_vector::vector_insn_info::get_avl_or_vl_reg() const
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:2297
0x98b1e3 riscv_vector::vector_insn_info::get_avl_or_vl_reg() const
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:2271
0x15f8d27 insert_vsetvl
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:724
0x15f990d pass_vsetvl::commit_vsetvls()
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:3615
0x15f9bc1 pass_vsetvl::pre_vsetvl()
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:3728
0x15fa908 pass_vsetvl::lazy_vsetvl()
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:4358
0x15faa11 pass_vsetvl::execute(function*)
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:4393
0x15faa11 pass_vsetvl::execute(function*)
        /home/jeremy/gittrees/mustang/gcc/gcc/config/riscv/riscv-vsetvl.cc:4374
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-gfortran
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=gf3ba57163ce --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 20230908 (experimental) (gf3ba57163ce)

             reply	other threads:[~2023-09-11 18:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 18:21 jeremy.bennett at embecosm dot com [this message]
2023-09-12  8:01 ` [Bug middle-end/111375] " juzhe.zhong at rivai dot ai
2023-09-12  8:04 ` jeremy.bennett at embecosm dot com
2023-09-12  8:07 ` juzhe.zhong at rivai dot ai
2023-09-12 16:22 ` jeremy.bennett at embecosm dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-111375-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).