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

            Bug ID: 123365
           Summary: ICE: in emit_move_insn, at expr.cc with inline asm
                    array-to-register constraint
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

Reproducer: https://godbolt.org/z/cjPncTK7a

The crash occurs during the RTL Expansion phase. The compiler is attempting to
satisfy a register constraint ("r") for a Compound Literal Array (long
long[]){0}, which leads to the conflict between the required register mode and
the actual memory mode.

```c
int main() {
    __asm__ volatile ("" : "+r"((long long[]){0}) : "r"((long long[]){0}));
}
```

Traceback:
```
internal compiler error: in emit_move_insn, at expr.cc:4636
   15 |     __asm__ volatile ("" : "+r"((long long[]){0}) : "r"((long
long[]){0})); // Induce REG_EQUAL note with mismatched mode
      |     ^~~~~~~
0x569ce3c internal_error(char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:517
0x563a4de fancy_abort(char const*, int, char const*)
        /workspace/install/gcc/src/gcc/gcc/diagnostic.cc:1749
0x15929bb emit_move_insn(rtx_def*, rtx_def*)
        /workspace/install/gcc/src/gcc/gcc/expr.cc:4636
0x1542988 force_reg(machine_mode, rtx_def*)
        /workspace/install/gcc/src/gcc/gcc/explow.cc:693
0x1290a93 expand_asm_stmt
        /workspace/install/gcc/src/gcc/gcc/cfgexpand.cc:3733
0x1293b16 expand_gimple_stmt_1
        /workspace/install/gcc/src/gcc/gcc/cfgexpand.cc:4215
0x1294734 expand_gimple_stmt
        /workspace/install/gcc/src/gcc/gcc/cfgexpand.cc:4365
0x12a3b0e expand_gimple_basic_block
        /workspace/install/gcc/src/gcc/gcc/cfgexpand.cc:6483
0x12a8415 execute
        /workspace/install/gcc/src/gcc/gcc/cfgexpand.cc:7232
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.
```

Reply via email to