[Mlir-commits] [mlir] [mlir] Fix possible null dereference during error logging in EmitC (PR #157456)
    llvmlistbot at llvm.org 
    llvmlistbot at llvm.org
       
    Mon Sep  8 06:27:36 PDT 2025
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Daniel Kuts (apach301)
<details>
<summary>Changes</summary>
Fixes #<!-- -->157452 
---
Full diff: https://github.com/llvm/llvm-project/pull/157456.diff
1 Files Affected:
- (modified) mlir/lib/Dialect/EmitC/IR/EmitC.cpp (+5-1) 
``````````diff
diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index a73470cdf76c5..6b88e2c525d07 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -1320,7 +1320,11 @@ GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
 
   // global has non-array type
   auto lvalueType = dyn_cast<LValueType>(resultType);
-  if (!lvalueType || lvalueType.getValueType() != globalType)
+  if (!lvalueType)
+    return emitOpError("on non-array type result type is not defined "
+                       "for the global @")
+           << getName();
+  if (lvalueType.getValueType() != globalType)
     return emitOpError("on non-array type expects result inner type ")
            << lvalueType.getValueType() << " to match type " << globalType
            << " of the global @" << getName();
``````````
</details>
https://github.com/llvm/llvm-project/pull/157456
    
    
More information about the Mlir-commits
mailing list