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

Mehdi Amini llvmlistbot at llvm.org
Sat Sep 13 12:06:07 PDT 2025


================
@@ -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 expects result type to be an "
+                       "lvalue type for the global @")
+           << getName();
----------------
joker-eph wrote:

We still need a test...

Seems like this should trigger with a getGlobalOp referencing a globalOp which is not an array type and not a LValueType?

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


More information about the Mlir-commits mailing list