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

            Bug ID: 124818
           Summary: RV32 Zbkb ICE on simple OR with 0x20000
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cmuellner at gcc dot gnu.org
  Target Milestone: ---

The RV32 compiler crashes with an internal compiler error when compiling a
trivial bitwise OR assignment if `Zbkb` is enabled.

Reproducer (-O2 -march=rv32gc_zbkb -mabi=ilp32d):
int f(unsigned int *flags) {
    *flags |= 0x20000U;
    return 1;
}

ICE details:
issue-zbkb-ice-repro.c: In function 'f':
issue-zbkb-ice-repro.c:4:1: error: unrecognizable insn:
    4 | }
      | ^
(insn 8 7 9 2 (set (reg:SI 135 [ _2 ])
        (ior:SI (reg:SI 134 [ _1 ])
            (const_int 131072 [0x20000]))) "issue-zbkb-ice-repro.c":2:12 -1
     (nil))
during RTL pass: vregs
issue-zbkb-ice-repro.c:4:1: internal compiler error: in extract_insn,
at recog.cc:2892

Backtrace:
0x29b65fd internal_error(char const*, ...)
0x6803b5 fancy_abort(char const*, int, char const*)
0x4fa100 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
0x4fa11c _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
0x4f8935 extract_insn(rtx_insn*)
0xa3ef13 instantiate_virtual_regs_in_insn
0xa3ef13 instantiate_virtual_regs
0xa3ef13 execute

Reduced trigger conditions:
- `-march=rv32gc`: OK
- `-march=rv32gc_zbb`: OK
- `-march=rv32gc_zknh`: OK
- `-march=rv32gc_zksh`: OK
- `-march=rv32gc_zbkb`: ICE

I have a fix that I will send on the list once I have allocated a PR number.

Reply via email to