public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/111566] New: RISC-V Vector Fortran: ICE in final_scan_insn_1 (final RTL pass)
@ 2023-09-24  8:09 jeremy.bennett at embecosm dot com
  2023-09-24  8:36 ` [Bug target/111566] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2023-09-24  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111566
           Summary: RISC-V Vector Fortran: ICE in final_scan_insn_1 (final
                    RTL 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 55979
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55979&action=edit
Reproducer

Issue discovered with the SPEC CPU 2017 627.cam4_s benchmark. It appears to be
an interaction between RISC-V vector and the -fmax-stack-var-size parameter.

Reproducer (test.f90)

module a
  integer,parameter :: SHR_KIND_R8 = selected_real_kind(12)
end module a
module b
  use a,  c => shr_kind_r8
contains
  subroutine d(cg , km, i1, i2)
    real (c) ch(i2,km)
    real (c) cg(4,i1:i2,km)
    real  dc(i2,km)
    real(c) ci(i2,km)
    real(c) cj(i2,km)
    do k=2,ck
       do i=i1,0
          cl = ci(i,k) *ci(i,1) /      cj(i,k)+ch(i,1)
          cm = cg(1,i,k) - min(e,cg(1,i,co))
          dc(i,k) = sign(cm, cl)
       enddo
    enddo
    if ( cq == 0 ) then
       do i=i1,i2
          if( cr <=  cs ) then
             cg= sign( min(ct,   cg),  cg)
          endif
       enddo
    endif
  end subroutine d
end module b

Compile with:

riscv64-unknown-linux-gnu-gfortran -w -march=rv64gcv -mabi=lp64d -c     -Ofast
-ftree-vectorize --param=riscv-autovec-preference=scalable    
-fallow-argument-mismatch -fmax-stack-var-size=65536 test.f90

Output is:

   27 |   end subroutine d
      |                  ^
Error: could not split insn
(insn 967 168 1115 (set (mem/c:V16DI (plus:DI (reg/f:DI 2 sp)
                (const_int 128 [0x80])) [4 %sfp+[-1024, -16] S128 A128])
        (mem/c:V16DI (reg/f:DI 2 sp) [4 %sfp+[-1152, -16] S128 A128]))
"test.f90":16:44 1117 {*movv16di_mem_to_mem}
     (nil))
during RTL pass: final
test.f90:27:18: internal compiler error: in final_scan_insn_1, at final.cc:2808
0x9d3f63 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /home/jeremy/gittrees/mustang/gcc/gcc/rtl-error.cc:108
0x965949 final_scan_insn_1
        /home/jeremy/gittrees/mustang/gcc/gcc/final.cc:2808
0xe952af final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*)
        /home/jeremy/gittrees/mustang/gcc/gcc/final.cc:2887
0xe954f4 final_1
        /home/jeremy/gittrees/mustang/gcc/gcc/final.cc:1979
0xe9601a rest_of_handle_final
        /home/jeremy/gittrees/mustang/gcc/gcc/final.cc:4240
0xe9601a execute
        /home/jeremy/gittrees/mustang/gcc/gcc/final.cc:4318
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=g59d27cc55a0 --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 20230923 (experimental) (g59d27cc55a0)

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

end of thread, other threads:[~2023-10-03  8:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-24  8:09 [Bug middle-end/111566] New: RISC-V Vector Fortran: ICE in final_scan_insn_1 (final RTL pass) jeremy.bennett at embecosm dot com
2023-09-24  8:36 ` [Bug target/111566] " pinskia at gcc dot gnu.org
2023-09-29 22:36 ` amylaar at gcc dot gnu.org
2023-09-30  0:28 ` amylaar at gcc dot gnu.org
2023-09-30  0:42 ` amylaar at gcc dot gnu.org
2023-09-30  0:58 ` amylaar at gcc dot gnu.org
2023-10-01  5:22 ` cvs-commit at gcc dot gnu.org
2023-10-03  8:30 ` 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).