[Mlir-commits] [mlir] [mlir] Fix possible null dereference during error logging (PR #157455)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 8 06:26:52 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Daniel Kuts (apach301)

<details>
<summary>Changes</summary>

Fixes #<!-- -->157451

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


1 Files Affected:

- (modified) mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp (+2-1) 


``````````diff
diff --git a/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp b/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
index e5496e53ae529..aa47e398eb684 100644
--- a/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
+++ b/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
@@ -405,7 +405,8 @@ std::unique_ptr<MPIImplTraits> MPIImplTraits::get(ModuleOp &moduleOp) {
     return std::make_unique<OMPIImplTraits>(moduleOp);
   if (!strAttr || strAttr.getValue() != "MPICH")
     moduleOp.emitWarning() << "Unknown \"MPI:Implementation\" value in DLTI ("
-                           << strAttr.getValue() << "), defaulting to MPICH";
+                           << (strAttr ? strAttr.getValue() : "<NULL>")
+                           << "), defaulting to MPICH";
   return std::make_unique<MPICHImplTraits>(moduleOp);
 }
 

``````````

</details>


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


More information about the Mlir-commits mailing list