[flang-commits] [flang] [flang][HLFIR] Fix use-after-free when rewriting users in `canonicalize` (PR #84371)

via flang-commits flang-commits at lists.llvm.org
Thu Mar 7 12:13:27 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 954f891af20d193f6a5f41d7ede6a9313a49cfc3 bcbd32fa277cfeebafd44cce79b47411bd838c22 -- flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
index 74d94cd654..4af8cd6c8a 100644
--- a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
+++ b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
@@ -1866,7 +1866,7 @@ hlfir::ForallIndexOp::canonicalize(hlfir::ForallIndexOp indexOp,
       return mlir::failure();
 
   auto insertPt = rewriter.saveInsertionPoint();
-  llvm::SmallVector<mlir::Operation*> users(indexOp->getResult(0).getUsers());
+  llvm::SmallVector<mlir::Operation *> users(indexOp->getResult(0).getUsers());
   for (mlir::Operation *user : users)
     if (auto loadOp = mlir::dyn_cast<fir::LoadOp>(user)) {
       rewriter.setInsertionPoint(loadOp);

``````````

</details>


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


More information about the flang-commits mailing list