From 09b3bd8ca308449331a46f209f767e99b76481e7 Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Tue, 6 May 2014 12:50:51 +0000 Subject: [PATCH] AArch64/ARM64: make NEON vector list parsing a bit more robust It doesn't change the results, but it seems silly not to diagnose obvious problems early on. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208083 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp | 7 +++++-- test/MC/ARM64/vector-lists.s | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp b/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp index 9ba1b73986b..c5fb364a61a 100644 --- a/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp +++ b/lib/Target/ARM64/AsmParser/ARM64AsmParser.cpp @@ -3131,10 +3131,13 @@ bool ARM64AsmParser::parseVectorList(OperandVector &Operands) { } } - if (Parser.getTok().is(AsmToken::EndOfStatement)) - Error(getLoc(), "'}' expected"); + if (Parser.getTok().isNot(AsmToken::RCurly)) + return Error(getLoc(), "'}' expected"); Parser.Lex(); // Eat the '}' token. + if (Count > 4) + return Error(S, "invalid number of vectors"); + unsigned NumElements = 0; char ElementKind = 0; if (!Kind.empty()) diff --git a/test/MC/ARM64/vector-lists.s b/test/MC/ARM64/vector-lists.s index 0d026022375..a9b2d198e86 100644 --- a/test/MC/ARM64/vector-lists.s +++ b/test/MC/ARM64/vector-lists.s @@ -14,7 +14,7 @@ ST4 {v0.8B-},[x0] // CHECK-ERRORS: error: invalid number of vectors -// CHECK-ERRORS: error: unexpected token in argument list +// CHECK-ERRORS: error: '}' expected // CHECK-ERRORS: error: mismatched register size suffix // CHECK-ERRORS: error: mismatched register size suffix // CHECK-ERRORS: error: vector register expected