diff options
| author | Ali Cheraghi <alichraghi@proton.me> | 2025-03-08 19:20:59 +0330 |
|---|---|---|
| committer | Ali Cheraghi <alichraghi@proton.me> | 2025-03-17 20:19:08 +0330 |
| commit | 2fc409a32f18b0c62e3918f0b832ed9e4c8d142d (patch) | |
| tree | e860ca01ea4e012ae135171521039f52cc5b505f /src/codegen | |
| parent | 2a4e06bcb30f71e83b14026bcbade6aac3aece84 (diff) | |
| download | zig-2fc409a32f18b0c62e3918f0b832ed9e4c8d142d.tar.gz zig-2fc409a32f18b0c62e3918f0b832ed9e4c8d142d.zip | |
spirv: don't hardcode test error type alignment
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 22aa9e7df0..aeede443bf 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -2821,6 +2821,7 @@ const NavGen = struct { /// TODO is to also write out the error as a function call parameter, and to somehow fetch /// the name of an error in the text executor. fn generateTestEntryPoint(self: *NavGen, name: []const u8, spv_test_decl_index: SpvModule.Decl.Index) !void { + const zcu = self.pt.zcu; const target = self.spv.target; const anyerror_ty_id = try self.resolveType(Type.anyerror, .direct); @@ -2950,7 +2951,7 @@ const NavGen = struct { .pointer = p_error_id, .object = error_id, .memory_access = .{ - .Aligned = .{ .literal_integer = @sizeOf(u16) }, + .Aligned = .{ .literal_integer = @intCast(Type.abiAlignment(.anyerror, zcu).toByteUnits().?) }, }, }); try section.emit(self.spv.gpa, .OpReturn, {}); |
