Skip to content

Conversation

apach301
Copy link
Contributor

@apach301 apach301 commented Sep 8, 2025

Fixes #157451

@llvmbot llvmbot added the mlir label Sep 8, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 8, 2025

@llvm/pr-subscribers-mlir

Author: Daniel Kuts (apach301)

Changes

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

@CoTinker CoTinker requested a review from fschlimb September 9, 2025 01:10
Copy link
Contributor

@CoTinker CoTinker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

Copy link
Contributor

@fschlimb fschlimb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@CoTinker CoTinker merged commit 671455a into llvm:main Sep 10, 2025
11 checks passed
@apach301 apach301 deleted the mlir-mpitollvm-null-dereference branch September 15, 2025 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possible NULL dereference in mlir/Conversion/MPIToLLVM
5 participants