Index: llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp =================================================================== --- llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp +++ llvm/lib/Target/AVR/MCTargetDesc/AVRInstPrinter.cpp @@ -100,6 +100,11 @@ void AVRInstPrinter::printOperand(const MCInst *MI, unsigned OpNo, raw_ostream &O) { + if (OpNo >= MI->size()) { + O << ""; + return; + } + const MCOperand &Op = MI->getOperand(OpNo); const MCOperandInfo &MOI = this->MII.get(MI->getOpcode()).OpInfo[OpNo]; @@ -125,6 +130,11 @@ /// being encoded as a pc-relative value. void AVRInstPrinter::printPCRelImm(const MCInst *MI, unsigned OpNo, raw_ostream &O) { + if (OpNo >= MI->size()) { + O << ""; + return; + } + const MCOperand &Op = MI->getOperand(OpNo); if (Op.isImm()) {