summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2012-11-29 23:47:11 +0000
committerKevin Enderby <enderby@apple.com>2012-11-29 23:47:11 +0000
commit136d6746c58fe3ab431e2279289646769918a48f (patch)
treed2a9631d5e2c62d365cee1169af2a0183397db59 /llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
parenta92db6773ad6054317a7f72a16e319eddd6d7edf (diff)
downloadbcm5719-llvm-136d6746c58fe3ab431e2279289646769918a48f.tar.gz
bcm5719-llvm-136d6746c58fe3ab431e2279289646769918a48f.zip
Fixed the arm disassembly of invalid BFI instructions to not build a bad MCInst
which would then cause an assert when printed. rdar://11437956 llvm-svn: 168960
Diffstat (limited to 'llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp')
-rw-r--r--llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
index f00142de50d..5de50d592e7 100644
--- a/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
+++ b/llvm/lib/Target/ARM/Disassembler/ARMDisassembler.cpp
@@ -1281,7 +1281,13 @@ static DecodeStatus DecodeBitfieldMaskOperand(MCInst &Inst, unsigned Val,
unsigned lsb = fieldFromInstruction(Val, 0, 5);
DecodeStatus S = MCDisassembler::Success;
- if (lsb > msb) Check(S, MCDisassembler::SoftFail);
+ if (lsb > msb) {
+ Check(S, MCDisassembler::SoftFail);
+ // The check above will cause the warning for the "potentially undefined
+ // instruction encoding" but we can't build a bad MCOperand value here
+ // with a lsb > msb or else printing the MCInst will cause a crash.
+ lsb = msb;
+ }
uint32_t msb_mask = 0xFFFFFFFF;
if (msb != 31) msb_mask = (1U << (msb+1)) - 1;
OpenPOWER on IntegriCloud