[Mlir-commits] [mlir] 05484c6 - [mlir] Fix bug in PDLL Parser (#155243)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 25 07:16:40 PDT 2025


Author: Youngsuk Kim
Date: 2025-08-25T07:16:36-07:00
New Revision: 05484c63332ffeef21f044080eb536fbe7daf599

URL: https://github.com/llvm/llvm-project/commit/05484c63332ffeef21f044080eb536fbe7daf599
DIFF: https://github.com/llvm/llvm-project/commit/05484c63332ffeef21f044080eb536fbe7daf599.diff

LOG: [mlir] Fix bug in PDLL Parser (#155243)

This reverts changes made to `mlir/lib/Tools/PDLL/Parser/Parser.cpp` in
095b41c6eedb3acc908dc63ee91ff77944c07d75 .

`raw_indented_ostream::printReindented()` reads from a string to which
it also concurrently writes to, causing unintended behavior.

Credits to @jackalcooper for finding the issue.

Added: 
    

Modified: 
    mlir/lib/Tools/PDLL/Parser/Parser.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
index 51e702a1bb53a..c883baa7be2c5 100644
--- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
@@ -147,8 +147,9 @@ class Parser {
     std::string docStr;
     {
       llvm::raw_string_ostream docOS(docStr);
+      std::string tmpDocStr = doc.str();
       raw_indented_ostream(docOS).printReindented(
-          StringRef(docStr).rtrim(" \t"));
+          StringRef(tmpDocStr).rtrim(" \t"));
     }
     return docStr;
   }


        


More information about the Mlir-commits mailing list