From a182be9b6cab86b3d52371efea1681161820cf1c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Mon, 19 Sep 2011 17:56:00 +0000 Subject: [PATCH] MCInstrAnalysis: Don't crash on instructions with no operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140027 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCInstrAnalysis.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/MC/MCInstrAnalysis.cpp b/lib/MC/MCInstrAnalysis.cpp index 03a35c597be..7736702f35a 100644 --- a/lib/MC/MCInstrAnalysis.cpp +++ b/lib/MC/MCInstrAnalysis.cpp @@ -12,7 +12,8 @@ using namespace llvm; uint64_t MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size) const { - if (Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL) + if (Inst.getNumOperands() == 0 || + Info->get(Inst.getOpcode()).OpInfo[0].OperandType != MCOI::OPERAND_PCREL) return -1ULL; int64_t Imm = Inst.getOperand(0).getImm();