[llvm] r356972 - X86AsmParser: Do not process a non-existent token
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 25 20:12:41 PDT 2019
Author: ctopper
Date: Mon Mar 25 20:12:41 2019
New Revision: 356972
URL: http://llvm.org/viewvc/llvm-project?rev=356972&view=rev
Log:
X86AsmParser: Do not process a non-existent token
This error can only happen if an unfinished operation is at Eof.
Patch by Brandon Jones
Differential Revision: https://reviews.llvm.org/D57379
Added:
llvm/trunk/test/MC/AsmParser/unfinished-op.s
Modified:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/X86/x86_operands.s
Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=356972&r1=356971&r2=356972&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Mar 25 20:12:41 2019
@@ -2992,6 +2992,11 @@ bool X86AsmParser::MatchAndEmitATTInstru
case Match_MnemonicFail:
break;
}
+ if (Op.getToken().empty()) {
+ Error(IDLoc, "instruction must have size higher than 0", EmptyRange,
+ MatchingInlineAsm);
+ return true;
+ }
// FIXME: Ideally, we would only attempt suffix matches for things which are
// valid prefixes, and we could just infer the right unambiguous
Added: llvm/trunk/test/MC/AsmParser/unfinished-op.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/unfinished-op.s?rev=356972&view=auto
==============================================================================
--- llvm/trunk/test/MC/AsmParser/unfinished-op.s (added)
+++ llvm/trunk/test/MC/AsmParser/unfinished-op.s Mon Mar 25 20:12:41 2019
@@ -0,0 +1,4 @@
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2>&1 > /dev/null| FileCheck %s --check-prefix=CHECK-ERROR
+
+#CHECK-ERROR: error: instruction must have size higher than 0
+ .byte 64;""
Modified: llvm/trunk/test/MC/X86/x86_operands.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/X86/x86_operands.s?rev=356972&r1=356971&r2=356972&view=diff
==============================================================================
--- llvm/trunk/test/MC/X86/x86_operands.s (original)
+++ llvm/trunk/test/MC/X86/x86_operands.s Mon Mar 25 20:12:41 2019
@@ -9,7 +9,7 @@
addl $a, %eax
# CHECK: addl $3, %eax
addl $1 + 2, %eax
-
+
# Disambiguation
# CHECK: addl $1, 8
@@ -26,7 +26,7 @@
addl $1, (%eax)
# CHECK: addl $1, 8(,%eax)
addl $1, (4+4)(,%eax)
-
+
# Indirect Memory Operands
# CHECK: addl $1, 1(%eax)
addl $1, 1(%eax)
More information about the llvm-commits
mailing list