1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[AArch64] Check the size of the vector before accessing its elements.

This fixes an assert in AArch64AsmParser::MatchAndEmitInstruction.

rdar://problem/23081753

llvm-svn: 250207
This commit is contained in:
Akira Hatanaka 2015-10-13 18:55:34 +00:00
parent 33d543ef55
commit f215a2dba1
2 changed files with 10 additions and 1 deletions

View File

@ -3967,7 +3967,7 @@ bool AArch64AsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
// suffix token operand. The short-form match failure is probably more
// relevant: use it instead.
if (MatchResult == Match_InvalidOperand && ErrorInfo == 1 &&
((AArch64Operand &)*Operands[1]).isToken() &&
Operands.size() > 1 && ((AArch64Operand &)*Operands[1]).isToken() &&
((AArch64Operand &)*Operands[1]).isTokenSuffix()) {
MatchResult = ShortFormNEONMatchResult;
ErrorInfo = ShortFormNEONErrorInfo;

View File

@ -480,3 +480,12 @@ tlbi vale3
; CHECK-ERRORS: error: invalid operand for instruction
; CHECK-ERRORS: b.eq 0, 0
; CHECK-ERRORS: ^
; Check that we give the proper "too few operands" diagnostic instead of
; asserting.
ldr
; CHECK-ERRORS: error: too few operands for instruction
; CHECK-ERRORS: ldr
; CHECK-ERRORS: ^