https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123218
Bug ID: 123218
Summary: [16 Regression] ICE: RTL check: expected code 'reg',
have 'mem' in rhs_regno, at rtl.h:1946 during
libgcc2.c build
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: build, ice-checking, ice-on-valid-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build with RTL checking enabled (maybe more conditions are needed) fails with:
$ /repo/build-gcc-trunk-amd64/./gcc/xgcc -B/repo/build-gcc-trunk-amd64/./gcc/
-B/repo/gcc-trunk//binary-trunk-20251219094221-g975339f58f3-checking-yes-rtl-df-extra-nobootstrap-amd64/x86_64-pc-linux-gnu/bin/
-B/repo/gcc-trunk//binary-trunk-20251219094221-g975339f58f3-checking-yes-rtl-df-extra-nobootstrap-amd64/x86_64-pc-linux-gnu/lib/../lib/
-isystem
/repo/gcc-trunk//binary-trunk-20251219094221-g975339f58f3-checking-yes-rtl-df-extra-nobootstrap-amd64/x86_64-pc-linux-gnu/include
-isystem
/repo/gcc-trunk//binary-trunk-20251219094221-g975339f58f3-checking-yes-rtl-df-extra-nobootstrap-amd64/x86_64-pc-linux-gnu/sys-include
-g -O2 -m32 -O2 -g -O2 -DIN_GCC -W -Wall -Wno-error=narrowing
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -fpic -mlong-double-80
-DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection
-mshstk -I. -I. -I../../.././gcc -I/repo/gcc-trunk/libgcc
-I/repo/gcc-trunk/libgcc/. -I/repo/gcc-trunk/libgcc/../gcc
-I/repo/gcc-trunk/libgcc/../include -I/repo/gcc-trunk/libgcc/config/i386
-I/repo/gcc-trunk/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
-DHAVE_CC_TLS -DUSE_TLS -o _multc3.o -MT _multc3.o -MD -MP -MF _multc3.dep
-DL_multc3 -c /repo/gcc-trunk/libgcc/libgcc2.c -fvisibility=hidden
-DHIDE_EXPORTS
during RTL pass: reload
/repo/gcc-trunk/libgcc/libgcc2.c: In function '__multc3':
/repo/gcc-trunk/libgcc/libgcc2.c:2746:1: internal compiler error: RTL check:
expected code 'reg', have 'mem' in rhs_regno, at rtl.h:1946
2746 | }
| ^
0x2c78c8d internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0x88bae5 rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int,
char const*)
/repo/gcc-trunk/gcc/rtl.cc:770
0x8403df rhs_regno(rtx_def const*)
/repo/gcc-trunk/gcc/rtl.h:1946
0x840d30 rhs_regno(rtx_def const*)
/repo/gcc-trunk/gcc/rtl.h:1523
0x840d30 match_reload
/repo/gcc-trunk/gcc/lra-constraints.cc:1247
0x1408df9 curr_insn_transform
/repo/gcc-trunk/gcc/lra-constraints.cc:4909
0x140b7c6 lra_constraints(bool)
/repo/gcc-trunk/gcc/lra-constraints.cc:5659
0x13f2f54 lra(_IO_FILE*, int)
/repo/gcc-trunk/gcc/lra.cc:2455
0x139c1af do_reload
/repo/gcc-trunk/gcc/ira.cc:6070
0x139c1af execute
/repo/gcc-trunk/gcc/ira.cc:6258
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.
make[4]: *** [Makefile:514: _multc3.o] Error 1
$ /repo/build-gcc-trunk-amd64/./gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=/repo/build-gcc-trunk-amd64/./gcc/xgcc
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --enable-libsanitizer --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20251219094221-g975339f58f3-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251219 (experimental) (GCC)