https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110996
Bug ID: 110996 Summary: RISC-V vector Fortran: SEGV ICE during parsing Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jeremy.bennett at embecosm dot com Target Milestone: --- Created attachment 55726 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55726&action=edit Fortran 90 source code for the test case This appears to be a failure in the Fortran parser, which only occurs if the RISC-V vector ISA extension is specified. This is the reproducer (testcase.f90): CONTAINS SUBROUTINE a END SUBROUTINE b END SUBROUTINE c(d) e SUBROUTINE f END END (which has a syntax error with the stray "e" at the end of the declaration of "SUBROUTINE c"). This is compiled with: riscv64-unknown-linux-gnu-gfortran -march=rv64gcv -mabi=lp64d -c \ -Ofast testcase.f90 NOTE. The error only occurs if the "v" extensions is specified in the "-march" string. The output is: testcase.f90:6:20: 6 | SUBROUTINE c(d) e | 1 Error: Syntax error in SUBROUTINE statement at (1) f951: internal compiler error: Segmentation fault 0x112a263 crash_signal /home/jeremy/gittrees/mustang/gcc/gcc/toplev.cc:314 0x7fdd1203c4af ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0xaaea0a resolve_symbol /home/jeremy/gittrees/mustang/gcc/gcc/fortran/resolve.cc:16643 0xadadc2 do_traverse_symtree /home/jeremy/gittrees/mustang/gcc/gcc/fortran/symbol.cc:4190 0xab95ed resolve_types /home/jeremy/gittrees/mustang/gcc/gcc/fortran/resolve.cc:17963 0xab9697 resolve_types /home/jeremy/gittrees/mustang/gcc/gcc/fortran/resolve.cc:17977 0xac08ec gfc_resolve(gfc_namespace*) /home/jeremy/gittrees/mustang/gcc/gcc/fortran/resolve.cc:18083 0xa9f250 resolve_all_program_units /home/jeremy/gittrees/mustang/gcc/gcc/fortran/parse.cc:6909 0xa9f250 gfc_parse_file() /home/jeremy/gittrees/mustang/gcc/gcc/fortran/parse.cc:7165 0xaf3533 gfc_be_parse_file /home/jeremy/gittrees/mustang/gcc/gcc/fortran/f95-lang.cc:229 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=g68783211f66 --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 20230811 (experimental) (g68783211f66)