diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 64850ad63f..8a3745edb2 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -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 } diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig index 9f430a105a..0ebdffd16c 100644 --- a/test/behavior/slice.zig +++ b/test/behavior/slice.zig @@ -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,