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>
This commit is contained in:
Austin Eng 2020-12-02 16:30:38 +00:00 committed by Commit Bot service account
parent b3becb2f25
commit 41083cbca4
1 changed files with 2 additions and 2 deletions

View File

@ -3092,9 +3092,9 @@ TypedExpression FunctionEmitter::MakeCompositeExtract(
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);