[PATCH] D32218: X86AsmParser.cpp asserts: OperandStack.size() > 1 && "Too few operands."

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 07:29:38 PDT 2017


avt77 updated this revision to Diff 100245.
avt77 added a comment.

I restored the condition like here:

  if (PrevTK != AsmToken::Error && Tok.getString().startswith(".") &&
      TK != AsmToken::Identifier)

I merged with trunk (both LLVM and Clang) and launched "check-all": there are no failed tests.
Reid, Chad - could you give me LGTM?


https://reviews.llvm.org/D32218

Files:
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  test/MC/X86/pr22004.s


Index: test/MC/X86/pr22004.s
===================================================================
--- test/MC/X86/pr22004.s
+++ test/MC/X86/pr22004.s
@@ -0,0 +1,3 @@
+// RUN: llvm-mc -triple x86_64-unknown-unknown -x86-asm-syntax=intel %s
+
+lea rax, qword ptr [rip + .L.str]
Index: lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1316,16 +1316,17 @@
   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()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32218.100245.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170525/47a98cbd/attachment.bin>


More information about the llvm-commits mailing list