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

The fix for PR22004: X86AsmParser.cpp asserts: OperandStack.size() > 1 && "Too few operands."

llvm-svn: 303985
This commit is contained in:
Andrew V. Tischenko 2017-05-26 13:23:34 +00:00
parent 8808a64045
commit e35b9c0cad
2 changed files with 6 additions and 2 deletions

View File

@ -1316,16 +1316,17 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
while (!Done) {
bool UpdateLocLex = true;
AsmToken::TokenKind TK = getLexer().getKind();
// The period in the dot operator (e.g., [ebx].foo.bar) is parsed as an
// identifier. Don't try an parse it as a register.
if (PrevTK != AsmToken::Error && Tok.getString().startswith("."))
if (PrevTK != AsmToken::Error && Tok.getString().startswith(".") &&
TK != AsmToken::Identifier)
break;
// If we're parsing an immediate expression, we don't expect a '['.
if (SM.getStopOnLBrac() && getLexer().getKind() == AsmToken::LBrac)
break;
AsmToken::TokenKind TK = getLexer().getKind();
switch (TK) {
default: {
if (SM.isValidEndState()) {

3
test/MC/X86/pr22004.s Normal file
View File

@ -0,0 +1,3 @@
// RUN: llvm-mc -triple x86_64-unknown-unknown -x86-asm-syntax=intel %s
lea rax, qword ptr [rip + .L.str]