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

Daniel Kuts llvmlistbot at llvm.org
Mon Sep 8 06:26:16 PDT 2025


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

Fixes #157451

>From 835c45e1ef65b3b6e8958d4ce76b5b7955c36225 Mon Sep 17 00:00:00 2001
From: Daniil Kutz <kutz at ispras.ru>
Date: Mon, 8 Sep 2025 16:19:53 +0300
Subject: [PATCH] [mlir] Fix possible null dereference during error logging

---
 mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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);
 }
 



More information about the Mlir-commits mailing list