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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 25 06:29:55 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Youngsuk Kim (JOE1994)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/155243.diff


1 Files Affected:

- (modified) mlir/lib/Tools/PDLL/Parser/Parser.cpp (+2-1) 


``````````diff
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;
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/155243


More information about the Mlir-commits mailing list