Skip to content

Commit 5b13110

Browse files
committed
[mlir] Fix possible null dereference during error logging in Dialect/EmitC
1 parent 6c0f7a5 commit 5b13110

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mlir/lib/Dialect/EmitC/IR/EmitC.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,11 @@ GetGlobalOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
13201320

13211321
// global has non-array type
13221322
auto lvalueType = dyn_cast<LValueType>(resultType);
1323-
if (!lvalueType || lvalueType.getValueType() != globalType)
1323+
if (!lvalueType)
1324+
return emitOpError("on non-array type result type is not defined "
1325+
"for the global @")
1326+
<< getName();
1327+
if (lvalueType.getValueType() != globalType)
13241328
return emitOpError("on non-array type expects result inner type ")
13251329
<< lvalueType.getValueType() << " to match type " << globalType
13261330
<< " of the global @" << getName();

0 commit comments

Comments
 (0)