zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit a7c3d5e4ec551e48166919ab55f618afe7c23b2a (tree)
parent 4ea361f6dc07826337255fdddcbdfca9b8c9a0a9
Author: Robin Voetter <robin@voetter.nl>
Date:   Sat, 23 Sep 2023 01:46:00 +0200

spirv: constant elem ptr fix

Diffstat:
Msrc/codegen/spirv.zig | 7++++---
Mtest/behavior/slice.zig | 1-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 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 @@ -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,