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

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 23 10:46:19 PDT 2024


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

>From d6e252cd2dddfbedfd221267ba50019c204428e8 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 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 6623106109316..998a61e6980eb 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -473,7 +473,9 @@ 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 ||
+             State == IES_OFFSET;
     }
 
     // Is the intel expression appended after an operand index.
@@ -1897,9 +1899,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