[llvm] [X86AsmParser] IntelExpression: End of Statement should check for valid end state (PR #95677)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 09:31:29 PDT 2024


https://github.com/v01dXYZ updated https://github.com/llvm/llvm-project/pull/95677

>From b5bf7c387b4f230525c63b325539d2a54d3f28e3 Mon Sep 17 00:00:00 2001
From: v01dxyz <v01dxyz at v01d.xyz>
Date: Sat, 15 Jun 2024 20:20:46 +0200
Subject: [PATCH] [X86AsmParser] IntelExpression: Check for valid end state on
 EndOfStatement

Fixes https://github.com/llvm/llvm-project/issues/94446
---
 llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 6623106109316..d338607acbabe 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -473,7 +473,8 @@ class X86AsmParser : public MCTargetAsmParser {
     unsigned getLength() const { return CurType.Length; }
     int64_t getImm() { return Imm + IC.execute(); }
     bool isValidEndState() const {
-      return State == IES_RBRAC || State == IES_INTEGER;
+      return State == IES_RBRAC || State == IES_RPAREN ||
+             State == IES_INTEGER || State == IES_REGISTER;
     }
 
     // Is the intel expression appended after an operand index.
@@ -1897,9 +1898,6 @@ bool X86AsmParser::ParseIntelExpression(IntelExprStateMachine &SM, SMLoc &End) {
     case AsmToken::Error:
       return Error(getLexer().getErrLoc(), getLexer().getErr());
       break;
-    case AsmToken::EndOfStatement:
-      Done = true;
-      break;
     case AsmToken::Real:
       // DotOperator: [ebx].0
       UpdateLocLex = false;



More information about the llvm-commits mailing list