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

Run:explore-b577f07195-20261129-105236
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, 909 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 b577f07195
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       0x0000557bda9f59eb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  llc       0x0000557bda9f29c1 llvm::sys::RunSignalHandlers() + 369
2  llc       0x0000557bda9f646b
3  libc.so.6 0x00007f3cfac45330
4  libc.so.6 0x00007f3cfac9ebec pthread_kill + 284
5  libc.so.6 0x00007f3cfac4527e gsignal + 30
6  libc.so.6 0x00007f3cfac288ff abort + 223
7  libc.so.6 0x00007f3cfac2881b
8  libc.so.6 0x00007f3cfac3b517
9  llc       0x0000557bd8e99781
10 llc       0x0000557bd937e5a1 llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr const*) + 2193
11 llc       0x0000557bd935d1a7 llvm::AsmPrinter::emitFunctionBody() + 4743
12 llc       0x0000557bd8e935d7
13 llc       0x0000557bd966f6b1 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 513
14 llc       0x0000557bd9c0ab37 llvm::FPPassManager::runOnFunction(llvm::Function&) + 871
15 llc       0x0000557bd9c13052 llvm::FPPassManager::runOnModule(llvm::Module&) + 50
16 llc       0x0000557bd9c0b8e0 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 2000
17 llc       0x0000557bd8e66149
18 llc       0x0000557bd8e632d3 main + 1747
19 libc.so.6 0x00007f3cfac2a1ca
20 libc.so.6 0x00007f3cfac2a28b __libc_start_main + 139
21 llc       0x0000557bd8e623e5 _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.