From de9e32a55dc412e62318e47f586e66a603c28fac Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 17 Dec 2014 16:17:44 +0000 Subject: [PATCH] ARM: correct an off-by-one in an assert The assert was off-by-one, resulting in failures for valid input. Thanks to Asiri Rathnayake for pointing out the failure! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224432 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 5 ++++- test/MC/ARM/arm-store-deprecated.s | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp index 76107924095..ecc7f0b1650 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp @@ -77,7 +77,10 @@ static bool getITDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI, static bool getARMStoreDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI, std::string &Info) { - assert(MI.getNumOperands() > 4 && "expected >4 arguments"); + if (STI.getFeatureBits() & llvm::ARM::ModeThumb) + return false; + + assert(MI.getNumOperands() >= 4 && "expected >= 4 arguments"); for (unsigned OI = 4, OE = MI.getNumOperands(); OI < OE; ++OI) { assert(MI.getOperand(OI).isReg() && "expected register"); if (MI.getOperand(OI).getReg() == ARM::SP || diff --git a/test/MC/ARM/arm-store-deprecated.s b/test/MC/ARM/arm-store-deprecated.s index d8c10e2f94a..8a598abc424 100644 --- a/test/MC/ARM/arm-store-deprecated.s +++ b/test/MC/ARM/arm-store-deprecated.s @@ -145,3 +145,9 @@ push: @ CHECK: push {sp} @ CHECK: ^ + .global single + .type single,%function +single: + stmdaeq r0, {r0} +@ CHECK-NOT: warning +