[llvm] r209802 - Add missing check when MatchInstructionImpl() reports failure
Artyom Skrobov
Artyom.Skrobov at arm.com
Thu May 29 04:26:17 PDT 2014
Author: askrobov
Date: Thu May 29 06:26:15 2014
New Revision: 209802
URL: http://llvm.org/viewvc/llvm-project?rev=209802&view=rev
Log:
Add missing check when MatchInstructionImpl() reports failure
Modified:
llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s
Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=209802&r1=209801&r2=209802&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Thu May 29 06:26:15 2014
@@ -3794,6 +3794,8 @@ bool AArch64AsmParser::MatchAndEmitInstr
case Match_InvalidLabel:
case Match_MSR:
case Match_MRS: {
+ if (ErrorInfo >= Operands.size())
+ return Error(IDLoc, "too few operands for instruction");
// Any time we get here, there's nothing fancy to do. Just get the
// operand SMLoc and display the diagnostic.
SMLoc ErrorLoc = ((AArch64Operand *)Operands[ErrorInfo])->getStartLoc();
Modified: llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s?rev=209802&r1=209801&r2=209802&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s (original)
+++ llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s Thu May 29 06:26:15 2014
@@ -395,6 +395,7 @@
cmn w11, w12, lsr #-1
cmn w11, w12, lsr #32
cmn w19, wzr, asr #-1
+ cmn wsp, w0
cmn wzr, wzr, asr #32
cmn x9, x10, lsl #-1
cmn x9, x10, lsl #64
@@ -417,6 +418,9 @@
// CHECK-ERROR-NEXT: error: expected integer shift amount
// CHECK-ERROR-NEXT: cmn w19, wzr, asr #-1
// CHECK-ERROR-NEXT: ^
+// CHECK-ERROR-NEXT: error: too few operands for instruction
+// CHECK-ERROR-NEXT: cmn wsp, w0
+// CHECK-ERROR-NEXT: ^
// CHECK-ERROR-NEXT: error: expected 'lsl', 'lsr' or 'asr' with optional integer in range [0, 31]
// CHECK-ERROR-NEXT: cmn wzr, wzr, asr #32
// CHECK-ERROR-NEXT: ^
More information about the llvm-commits
mailing list