https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124940
Bug ID: 124940
Summary: during GIMPLE pass: bitintlower0 ICE: in
finish_arith_overflow, at gimple-lower-bitint.cc:4360
with -mbig-endian
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: riscv64-unknown-linux-gnu
Created attachment 64243
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64243&action=edit
reduced testcase
The status of big endian riscv targets is unclear.
$ riscv64-unknown-linux-gnu-gcc -mbig-endian testcase.c
during GIMPLE pass: bitintlower0
testcase.c: In function 'foo':
testcase.c:4:1: internal compiler error: in finish_arith_overflow, at
gimple-lower-bitint.cc:4360
4 | foo()
| ^~~
0x36b5d9d internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:787
0x1153797 fancy_abort(char const*, int, char const*)
/repo/gcc-trunk/gcc/diagnostics/context.cc:1813
0x10b48eb finish_arith_overflow
/repo/gcc-trunk/gcc/gimple-lower-bitint.cc:4360
0x3306e52 lower_addsub_overflow
/repo/gcc-trunk/gcc/gimple-lower-bitint.cc:5037
0x330adbd lower_call
/repo/gcc-trunk/gcc/gimple-lower-bitint.cc:5903
0x3316c8a gimple_lower_bitint
/repo/gcc-trunk/gcc/gimple-lower-bitint.cc:7759
/repo/gcc-trunk/binary-trunk-20260420021623-r16-8755-g6dce04499cc2f7-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/16.0.1/cc1
-quiet -imultilib . -iprefix
/repo/gcc-trunk/binary-trunk-20260420021623-r16-8755-g6dce04499cc2f7-checking-yes-rtl-df-extra-riscv64/bin/../lib/gcc/riscv64-unknown-linux-gnu/16.0.1/
testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c
-mbig-endian -march=rv64imafdc_zmmul_zaamo_zalrsc_zca_zcd -mabi=lp64d
-misa-spec=2.2 -mtls-dialect=trad -march=rv64imafdc_zmmul_zaamo_zalrsc_zca_zcd
-o /tmp/ccxk4nSW.s
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.
$ riscv64-unknown-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-riscv64/bin/riscv64-unknown-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-20260420021623-r16-8755-g6dce04499cc2f7-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/16.0.1/lto-wrapper
Target: riscv64-unknown-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--with-isa-spec=2.2 --with-sysroot=/usr/riscv64-unknown-linux-gnu
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=riscv64-unknown-linux-gnu
--with-ld=/usr/bin/riscv64-unknown-linux-gnu-ld
--with-as=/usr/bin/riscv64-unknown-linux-gnu-as --disable-multilib
--enable-libsanitizer --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-20260420021623-r16-8755-g6dce04499cc2f7-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260420 (experimental) (GCC)