spirv-reader: Fix bug with passing stack-allocated variable
When handling OpCompositeExtract, the SPIRV reader uses a
stack-allocated U32 type instead of one heap allocated by the
type manager. This causes type determination later to dereference
a garbage address.
Change-Id: I7d60b6dbf8310e53565d7db47eac4dd92b1bbfa0
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/34684
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc
index db9625c..5ea523c 100644
--- a/src/reader/spirv/function.cc
+++ b/src/reader/spirv/function.cc
@@ -3092,9 +3092,9 @@
TypedExpression current_expr(MakeOperand(inst, 0));
auto make_index = [this](uint32_t literal) {
- ast::type::U32 u32;
+ auto* type = create<ast::type::U32>();
return create<ast::ScalarConstructorExpression>(
- create<ast::UintLiteral>(&u32, literal));
+ create<ast::UintLiteral>(type, literal));
};
const auto composite = inst.GetSingleWordInOperand(0);