From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB0863858C66; Sun, 24 Sep 2023 08:09:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB0863858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695542950; bh=BGjQizsMH1/hM6MamFQVvyVNwdogaUFzTv1WtsV0Tr8=; h=From:To:Subject:Date:From; b=Rdh8V9KcvP+41rG0eJC/Vz+iZsik1MsXlyvWYmtnzEkc0iFfwewtZjTl0X8klE+rR or55LvNJ84nTY7NdsWOqAwCGCRQZJC0ut9OvRerDFrXAmaJahO/fo0P+/Wtd6JlFQ8 A9M/iC7AFFnd3yLyyBJ6GGwX9mFTdEUvSa9LlYHw= From: "jeremy.bennett at embecosm dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/111566] New: RISC-V Vector Fortran: ICE in final_scan_insn_1 (final RTL pass) Date: Sun, 24 Sep 2023 08:09:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jeremy.bennett at embecosm dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111566 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=3D55979&action=3Dedit 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 =3D selected_real_kind(12) end module a module b use a, c =3D> 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=3D2,ck do i=3Di1,0 cl =3D ci(i,k) *ci(i,1) / cj(i,k)+ch(i,1) cm =3D cg(1,i,k) - min(e,cg(1,i,co)) dc(i,k) =3D sign(cm, cl) enddo enddo if ( cq =3D=3D 0 ) then do i=3Di1,i2 if( cr <=3D cs ) then cg=3D sign( min(ct, cg), cg) endif enddo endif end subroutine d end module b Compile with: riscv64-unknown-linux-gnu-gfortran -w -march=3Drv64gcv -mabi=3Dlp64d -c = -Ofast -ftree-vectorize --param=3Driscv-autovec-preference=3Dscalable=20=20=20=20 -fallow-argument-mismatch -fmax-stack-var-size=3D65536 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 for instructions. System information =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Using built-in specs. COLLECT_GCC=3Driscv64-unknown-linux-gnu-gfortran COLLECT_LTO_WRAPPER=3D/home/jeremy/gittrees/mustang/install/libexec/gcc/ris= cv64-unknown-linux-gnu/14.0.0/lto-wrapper Target: riscv64-unknown-linux-gnu Configured with: /home/jeremy/gittrees/mustang/gcc/configure --target=3Driscv64-unknown-linux-gnu --prefix=3D/home/jeremy/gittrees/mustang/install --with-sysroot=3D/home/jeremy/gittrees/mustang/install/sysroot --with-pkgversion=3Dg59d27cc55a0 --with-system-zlib --enable-shared --enabl= e-tls --enable-languages=3Dc,c++,fortran --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libsanitizer --disable-nls --disable-bootst= rap --src=3D/home/jeremy/gittrees/mustang/gcc --enable-multilib --with-abi=3Dlp= 64d --with-arch=3Drv64gc --with-tune=3D --with-isa-spec=3D20191213 'CFLAGS_FOR_= TARGET=3D-O2 -mcmodel=3Dmedany' 'CXXFLAGS_FOR_TARGET=3D-O2 -mcmodel=3Dmedany' Thread model: posix Supported LTO compression algorithms: zlib gcc version 14.0.0 20230923 (experimental) (g59d27cc55a0)=