spirv: constant elem ptr fix

This commit is contained in:
Robin Voetter 2023-09-23 01:46:00 +02:00
parent 4ea361f6dc
commit a7c3d5e4ec
No known key found for this signature in database
2 changed files with 4 additions and 4 deletions

View File

@ -784,11 +784,12 @@ pub const DeclGen = struct {
.opt_payload => unreachable, // TODO
.comptime_field => unreachable,
.elem => |elem_ptr| {
const elem_ptr_ty = mod.intern_pool.typeOf(elem_ptr.base).toType();
const parent_ptr_id = try self.constantPtr(elem_ptr_ty, elem_ptr.base.toValue());
const parent_ptr_ty = mod.intern_pool.typeOf(elem_ptr.base).toType();
const parent_ptr_id = try self.constantPtr(parent_ptr_ty, elem_ptr.base.toValue());
const size_ty_ref = try self.sizeType();
const index_id = try self.constInt(size_ty_ref, elem_ptr.index);
return self.ptrAccessChain(result_ty_ref, parent_ptr_id, index_id, &.{});
return try self.ptrElemPtr(parent_ptr_ty, parent_ptr_id, index_id);
},
.field => unreachable, // TODO
}

View File

@ -219,7 +219,6 @@ test "slice string literal has correct type" {
test "result location zero sized array inside struct field implicit cast to slice" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const E = struct {
entries: []u32,