-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Closed
Labels
Description
Test commit: 5a86dc996c26299de63effc927075dcbfb924167
Description:
mlir-opt
ends up triggering undefined behavior (null pointer dereference) when processing SPIR-V module with function calls and custom attributes (detected by UndefinedBehaviorSanitizer)
Steps to reproduce
- Minimal MLIR program (test.mlir)
"builtin.module"() ({
"spirv.module"() <{
addressing_model = #spirv.addressing_model<Logical>,
memory_model = #spirv.memory_model<GLSL450>
}> ({
"spirv.func"() <{
function_control = #spirv.function_control<None>,
function_type = (f32) -> f32,
sym_name = "bar"
}> ({
^bb0(%arg0: f32):
%0 = "spirv.FunctionCall"(%arg0) <{callee = @foo}> : (f32) -> f32
"spirv.ReturnValue"(%0) : (f32) -> ()
}) : () -> ()
"spirv.func"() <{
function_control = #spirv.function_control<None>,
message = "2nd parent",
sym_name = "foo"
}> ({
^bb0(%arg0: f32):
"spirv.ReturnValue"(%arg0) : (f32) -> ()
}) : () -> ()
}) : () -> ()
}) : () -> ()
Command:
mlir-opt test.mlir
Output:
/workdir/llvm-project/build/tools/mlir/include/mlir/IR/BuiltinAttributes.cpp.inc:735:21: runtime error: member access within null pointer of type 'mlir::detail::StorageUserBase<mlir::TypeAttr, mlir::Attribute, mlir::detail::TypeAttrStorage, mlir::detail::AttributeUniquer>::ImplType' (aka 'mlir::detail::TypeAttrStorage')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /workdir/llvm-project/build/tools/mlir/include/mlir/IR/BuiltinAttributes.cpp.inc:735:21 in