https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118084

            Bug ID: 118084
           Summary: [15 Regression] RISC-V: ICE in emit_move_insn, at
                    expr.cc:4635
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

Testcase:
unsigned a;
int main() {
  int b = 8;
  for (; b; b--)
    if (a & 1)
      a = a >> 1 ^ 30196000;
    else
      a >>= 1;
}


Command/backtrace:
> /scratch/tc-testing/tc-compiler-fuzz-trunk/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
>  -march=rv32izk   -mabi=ilp32 -Os  preprocessed.c -c -S -o /dev/null
during RTL pass: expand
preprocessed.c: In function 'main':
preprocessed.c:2:5: internal compiler error: in emit_move_insn, at expr.cc:4635
    2 | int main() {
      |     ^~~~
0x3090816 internal_error(char const*, ...)
        ../../../gcc/gcc/diagnostic-global-context.cc:517
0xcb345a fancy_abort(char const*, int, char const*)
        ../../../gcc/gcc/diagnostic.cc:1722
0xabe534 emit_move_insn(rtx_def*, rtx_def*)
        ../../../gcc/gcc/expr.cc:4635
0x1859420 generate_reflecting_code_using_brev(rtx_def**)
        ../../../gcc/gcc/config/riscv/riscv.cc:13610
0xfd315e expand_reversed_crc_table_based(rtx_def*, rtx_def*, rtx_def*,
rtx_def*, machine_mode, void (*)(rtx_def**))
        ../../../gcc/gcc/expr.cc:14568
0x21565d4 gen_crc_revqisi4(rtx_def*, rtx_def*, rtx_def*, rtx_def*)
        ../../../gcc/gcc/config/riscv/bitmanip.md:1229
0x129d81c maybe_expand_insn(insn_code, unsigned int, expand_operand*)
        ../../../gcc/gcc/optabs.cc:8237
0x129d81c expand_insn(insn_code, unsigned int, expand_operand*)
        ../../../gcc/gcc/optabs.cc:8268
0x110bfeb expand_crc_optab_fn
        ../../../gcc/gcc/internal-fn.cc:4043
0xfbd27c expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../../gcc/gcc/expr.cc:11377
0xfc9941 store_expr(tree_node*, rtx_def*, int, bool, bool)
        ../../../gcc/gcc/expr.cc:6770
0xfcbaab expand_assignment(tree_node*, tree_node*, bool)
        ../../../gcc/gcc/expr.cc:6491
0xe80816 expand_gimple_stmt_1
        ../../../gcc/gcc/cfgexpand.cc:4041
0xe80816 expand_gimple_stmt
        ../../../gcc/gcc/cfgexpand.cc:4122
0xe85920 expand_gimple_basic_block
        ../../../gcc/gcc/cfgexpand.cc:6185
0xe878f6 execute
        ../../../gcc/gcc/cfgexpand.cc:6924
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.


Tested with:
riscv64-unknown-linux-gnu-gcc (gd17b09c07a1) 15.0.0 20241217 (experimental)

Found via fuzzer.

https://godbolt.org/z/31dP85qzf

Reply via email to