zig

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

commit cf950691cb967826c4df5bede1bb5c654fede129 (tree)
parent 7140d08334de7d3c0c1342a0c2eb8a8db638b5df
Author: Quint Daenen <quint@daenen.email>
Date:   Mon,  4 May 2026 20:34:15 +0200

fix(spirv): error cleanly on integer types wider than 64 bits

resolveType called Module.intType for any integer width, which
asserted backing_bits <= 64 for big-int types. Reject these widths
in resolveType with a fail() so users get a diagnostic instead of
a compiler panic.

Diffstat:
Msrc/codegen/spirv/CodeGen.zig | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig @@ -1620,6 +1620,10 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { return try cg.module.opaqueType("u0"); } const int_info = ty.intInfo(zcu); + const backing_bits, const big_int = cg.module.backingIntBits(int_info.bits); + if (big_int and backing_bits > 64) { + return cg.fail("integer width of {} bits is not yet supported on the SPIR-V backend", .{int_info.bits}); + } return try cg.module.intType(int_info.signedness, int_info.bits); }, .@"enum" => return try cg.resolveType(ty.intTagType(zcu), repr),