From e23aea28f9ed4c1bb7dc81c92786ca49aa887088 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Wed, 27 Apr 2011 21:02:27 +0000 Subject: [PATCH] Fix a bug in the case that there is no add or subtract symbol and the offset value is zero so it does not add a NULL expr operand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130330 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp b/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp index 942a74b9088..642829cdab0 100644 --- a/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp +++ b/lib/Target/ARM/Disassembler/ARMDisassemblerCore.cpp @@ -3800,8 +3800,12 @@ bool ARMBasicMCBuilder::tryAddingSymbolicOperand(uint64_t Value, Expr = MCBinaryExpr::CreateAdd(Add, Off, *Ctx); else Expr = Add; - } else - Expr = Off; + } else { + if (Off != 0) + Expr = Off; + else + Expr = MCConstantExpr::Create(0, *Ctx); + } if (SymbolicOp.VariantKind == LLVMDisassembler_VariantKind_ARM_HI16) MI.addOperand(MCOperand::CreateExpr(ARMMCExpr::CreateUpper16(Expr, *Ctx)));