crash: Assertion failed: (MI->getNumOperands() > OpNo + 1 && "Expected additional operand"), function bool, file RISCVAsmPrinter.cpp

Run:explore-db12fc36f6-20261127-115111
Kind:crash
Category:Assertion failed: (MI->getNumOperands() > OpNo + 1 && "Expected additional operand"), function bool, file RISCVAsmPrinter.cpp
Occurrences:14 in 10 configs, 2 test files, 630 more counted only
Snippet from:inline-asm-mem-constraint.ll @constraint_m_2 via llvm-extract
Config:-mtriple=riscv32 -code-model=medium -verify-machineinstrs
Local check:reproduces at db12fc36f6
Compiler Explorer:https://godbolt.org/z/Pb8GMW3Kj (llc-assertions-trunk, checked 2026-10-26 12:20 UTC): G reproduces

Snippet:

; Function Attrs: nounwind
define i32 @constraint_m_2(ptr %a) #0 {
  %1 = tail call i32 asm "lw $0, $1", "=r,*m"(ptr elementtype(i32) %a)
  ret i32 %1
}

attributes #0 = { nounwind }

Compiler Explorer panes:

PaneOptionsExitInstsstderr
GlobalISel-mtriple=riscv32 -code-model=medium -verify-machineinstrs -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.*1340llc: /root/llvm-project/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp:514: virtual bool {anonymous}::RISCVAsmPrinter::PrintAsmMemoryOperand(const llvm::MachineInstr*, unsigned int, const char*, llvm::raw_ostream&): Assertion `MI->getNumOperands() > OpNo + 1 && "Expected additional operand"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
SelectionDAG (control)-mtriple=riscv32 -code-model=medium -verify-machineinstrs -global-isel=002-

Reproduce:

llc -mtriple=riscv32 -code-model=medium -verify-machineinstrs -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* snippet.ll -o -
llc -mtriple=riscv32 -code-model=medium -verify-machineinstrs -global-isel=0 snippet.ll -o -

Local llc output:

llc: /home/runner/work/llvm-fuzz/llvm-fuzz/llvm-project/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp:519: virtual bool (anonymous namespace)::RISCVAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *, unsigned int, const char *, raw_ostream &): Assertion `MI->getNumOperands() > OpNo + 1 && "Expected additional operand"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /home/runner/work/llvm-fuzz/llvm-fuzz/llvm-project/build/bin/llc -mtriple=riscv32 -code-model=medium -verify-machineinstrs -global-isel -global-isel-abort=2 -pass-remarks-missed=gisel.* -o -
1.	Running pass 'Function Pass Manager' on module '<stdin>'.
2.	Running pass 'RISC-V Assembly Printer' on function '@constraint_m_2'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  llc       0x00005610f8eaac1b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  llc       0x00005610f8ea7bf1 llvm::sys::RunSignalHandlers() + 369
2  llc       0x00005610f8eab69b
3  libc.so.6 0x00007ff1d8845330
4  libc.so.6 0x00007ff1d889ebec pthread_kill + 284
5  libc.so.6 0x00007ff1d884527e gsignal + 30
6  libc.so.6 0x00007ff1d88288ff abort + 223
7  libc.so.6 0x00007ff1d882881b
8  libc.so.6 0x00007ff1d883b517
9  llc       0x00005610f734dcc1
10 llc       0x00005610f7832bd1 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const*) + 2193
11 llc       0x00005610f78118c7 llvm::AsmPrinter::emitFunctionBody() + 4743
12 llc       0x00005610f7347b17
13 llc       0x00005610f7b23761 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 513
14 llc       0x00005610f80bfa77 llvm::FPPassManager::runOnFunction(llvm::Function&) + 871
15 llc       0x00005610f80c7f92 llvm::FPPassManager::runOnModule(llvm::Module&) + 50
16 llc       0x00005610f80c0820 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 2000
17 llc       0x00005610f731a689
18 llc       0x00005610f7317813 main + 1747
19 libc.so.6 0x00007ff1d882a1ca
20 libc.so.6 0x00007ff1d882a28b __libc_start_main + 139
21 llc       0x00005610f7316925 _start + 37

Occurrences (14):

InputFunctionConfig
inline-asm-mem-constraint-2.ll-mtriple=riscv32 -code-model=medium -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint-2.ll-mtriple=riscv32 -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint-2.ll-mtriple=riscv64 -code-model=medium -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint-2.ll-mtriple=riscv64 -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint.ll-mtriple=riscv32 -code-model=medium -verify-machineinstrs
inline-asm-mem-constraint.ll-mtriple=riscv32 -code-model=medium -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint.ll-mtriple=riscv32 -verify-machineinstrs
inline-asm-mem-constraint.ll-mtriple=riscv32 -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint.ll-mtriple=riscv64 -code-model=large -verify-machineinstrs
inline-asm-mem-constraint.ll-mtriple=riscv64 -code-model=large -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint.ll-mtriple=riscv64 -code-model=medium -verify-machineinstrs
inline-asm-mem-constraint.ll-mtriple=riscv64 -code-model=medium -verify-machineinstrs -no-integrated-as
inline-asm-mem-constraint.ll-mtriple=riscv64 -verify-machineinstrs
inline-asm-mem-constraint.ll-mtriple=riscv64 -verify-machineinstrs -no-integrated-as

Generated 2026-11-29 14:49 UTC.