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

Run:explore-d9924131a4-20261128-105811
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, 661 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 d9924131a4
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       0x0000558581804b5b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  llc       0x0000558581801b31 llvm::sys::RunSignalHandlers() + 369
2  llc       0x00005585818055db
3  libc.so.6 0x00007fc042c45330
4  libc.so.6 0x00007fc042c9ebec pthread_kill + 284
5  libc.so.6 0x00007fc042c4527e gsignal + 30
6  libc.so.6 0x00007fc042c288ff abort + 223
7  libc.so.6 0x00007fc042c2881b
8  libc.so.6 0x00007fc042c3b517
9  llc       0x000055857fca7f01
10 llc       0x000055858018cd61 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const*) + 2193
11 llc       0x000055858016b967 llvm::AsmPrinter::emitFunctionBody() + 4743
12 llc       0x000055857fca1d57
13 llc       0x000055858047d891 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 513
14 llc       0x0000558580a197f7 llvm::FPPassManager::runOnFunction(llvm::Function&) + 871
15 llc       0x0000558580a21d12 llvm::FPPassManager::runOnModule(llvm::Module&) + 50
16 llc       0x0000558580a1a5a0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 2000
17 llc       0x000055857fc748c9
18 llc       0x000055857fc71a53 main + 1747
19 libc.so.6 0x00007fc042c2a1ca
20 libc.so.6 0x00007fc042c2a28b __libc_start_main + 139
21 llc       0x000055857fc70b65 _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.