https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122106
Bug ID: 122106
Summary: ICE: in expand_reversed_crc_table_based, at
expr.cc:14704 with __builtin_rev_crc16_data16()
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: ice-checking
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: riscv64-unknown-linux-gnu
Created attachment 62479
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62479&action=edit
reduced testcase
Compiler output:
$ riscv64-unknown-linux-gnu-gcc testcase.c
during RTL pass: expand
testcase.c: In function 'foo':
testcase.c:1:22: internal compiler error: in expand_reversed_crc_table_based,
at expr.cc:14704
1 | short foo() { return __builtin_rev_crc16_data16(0, 0, 0); }
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x3377c1c internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:786
0x1077ff7 fancy_abort(char const*, int, char const*)
/repo/gcc-trunk/gcc/diagnostics/context.cc:1803
0xb85712 expand_reversed_crc_table_based(rtx_def*, rtx_def*, rtx_def*,
rtx_def*, machine_mode, void (*)(rtx_def**))
/repo/gcc-trunk/gcc/expr.cc:14704
0x25f1586 gen_crc_revhihi4(rtx_def*, rtx_def*, rtx_def*, rtx_def*)
/repo/gcc-trunk/gcc/config/riscv/bitmanip.md:1251
0x170bb68 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
/repo/gcc-trunk/gcc/optabs.cc:8257
0x170bb68 expand_insn(insn_code, unsigned int, expand_operand*)
/repo/gcc-trunk/gcc/optabs.cc:8288
0x155e9a0 expand_crc_optab_fn
/repo/gcc-trunk/gcc/internal-fn.cc:4063
0x128dd0f expand_call_stmt
/repo/gcc-trunk/gcc/cfgexpand.cc:3124
0x128dd0f expand_gimple_stmt_1
/repo/gcc-trunk/gcc/cfgexpand.cc:4235
0x128dd0f expand_gimple_stmt
/repo/gcc-trunk/gcc/cfgexpand.cc:4382
0x128fe37 expand_gimple_basic_block
/repo/gcc-trunk/gcc/cfgexpand.cc:6501
0x1292207 execute
/repo/gcc-trunk/gcc/cfgexpand.cc:7248
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-20250930161246-r16-4143-g6e624833cbe0a7-checking-yes-rtl-df-extra-riscv64/bin/../libexec/gcc/riscv64-unknown-linux-gnu/16.0.0/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-20250930161246-r16-4143-g6e624833cbe0a7-checking-yes-rtl-df-extra-riscv64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250930 (experimental) (GCC)