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)