https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109760
Bug ID: 109760
Summary: riscv Internal compiler error in extract_insn after
addition of XTheadCondMov
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: sepotvin at gmail dot com
Target Milestone: ---
I get the following internal compiler error after the addition of support of
XTheadCondMov in commit "basepoints/gcc-13-6686-g8e7ffe126de" when using the
following compile options: "-O2 -mcpu=sifive-u74" or "-O1 -mcpu-sifive-u74"
with a riscv64-unknown-linux-gnu compiler. The bug is still present on a recent
master (basepoints/gcc-14-540-gb7fe38c14e5)
./cross/riscv64/bin/riscv64-unknown-linux-gnu-gcc -O1 -mcpu=sifive-u74 -c
./qgridlayoutengine.ii
./qgridlayoutengine.ii: In function 'void e()':
./qgridlayoutengine.ii:14:1: error: unrecognizable insn:
14 | }
| ^
(insn 12 11 13 2 (set (reg:DI 137)
(if_then_else:DI (ne:DF (reg:DF 139)
(reg:DF 140))
(reg:DI 141)
(reg:DI 143))) -1
(nil))
during RTL pass: vregs
./qgridlayoutengine.ii:14:1: internal compiler error: in extract_insn, at
recog.cc:2791
0x82e78d _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
/home/spotvin/work/gcc-13.1.0-failure/cross/gcc/gcc/rtl-error.cc:108
0x82e7a9 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
/home/spotvin/work/gcc-13.1.0-failure/cross/gcc/gcc/rtl-error.cc:116
0x82d133 extract_insn(rtx_insn*)
/home/spotvin/work/gcc-13.1.0-failure/cross/gcc/gcc/recog.cc:2791
0xe80f9d instantiate_virtual_regs_in_insn
/home/spotvin/work/gcc-13.1.0-failure/cross/gcc/gcc/function.cc:1611
0xe80f9d instantiate_virtual_regs
/home/spotvin/work/gcc-13.1.0-failure/cross/gcc/gcc/function.cc:1985
0xe80f9d execute
/home/spotvin/work/gcc-13.1.0-failure/cross/gcc/gcc/function.cc:2034
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.
Here's the code snippet that can reproduce the issue
struct a {
void b();
} boxes;
struct {
a boxes;
} c;
double d;
void e() {
bool f(d);
for (;;) {
a &g = f ? c.boxes : boxes;
g.b();
}
}
The output of gcc -v is
COLLECT_GCC=./cross/riscv64/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/home/spotvin/work/gcc-13.1.0-failure/cross/riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/13.0.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/home/spotvin/work/gcc-13.1.0-failure/cross/riscv-gnu-toolchain/build/../../gcc/configure
--target=riscv64-unknown-linux-gnu
--prefix=/home/spotvin/work/gcc-13.1.0-failure/cross/riscv-gnu-toolchain/build/../../riscv64
--with-sysroot=/home/spotvin/work/gcc-13.1.0-failure/cross/riscv-gnu-toolchain/build/../../riscv64/sysroot
--with-pkgversion=g8e7ffe126de --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/spotvin/work/gcc-13.1.0-failure/cross/gcc --disable-multilib
--with-abi=lp64d --with-arch=rv64imafdc --with-tune=rocket
--with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
'CXXFLAGS_FOR_TARGET=-O2 -mcmodel=medlow'
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.1 20230315 (experimental) (g8e7ffe126de)
I used a cross-compiler to speedup the bisection of the commit where the issue
appeared but I got the same behavior with a native gcc:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-unknown-linux-gnu/13/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-13.1.0-r1/work/gcc-13.1.0/configure
--host=riscv64-unknown-linux-gnu --build=riscv64-unknown-linux-gnu
--prefix=/usr --bindir=/usr/riscv64-unknown-linux-gnu/gcc-bin/13
--includedir=/usr/lib/gcc/riscv64-unknown-linux-gnu/13/include
--datadir=/usr/share/gcc-data/riscv64-unknown-linux-gnu/13
--mandir=/usr/share/gcc-data/riscv64-unknown-linux-gnu/13/man
--infodir=/usr/share/gcc-data/riscv64-unknown-linux-gnu/13/info
--with-gxx-include-dir=/usr/lib/gcc/riscv64-unknown-linux-gnu/13/include/g++-v13
--with-python-dir=/share/gcc-data/riscv64-unknown-linux-gnu/13/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 13.1.0-r1 p1'
--with-gcc-major-version-only --disable-esp --enable-libstdcxx-time
--enable-lto --disable-libstdcxx-pch --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-fixed-point --with-abi=lp64d --enable-libgomp --disable-libssp
--disable-libada --disable-cet --disable-systemtap
--disable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --without-isl --enable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.1.0 (Gentoo 13.1.0-r1 p1)