authorgravatar for quint@daenen.emailQuint Daenen <quint@daenen.email> 2026-05-04 20:34:15+02:00
committergravatar for alichraghi@noreply.codeberg.orgAli Cheraghi <alichraghi@noreply.codeberg.org> 2026-06-18 13:38:58+02:00
logcf950691cb967826c4df5bede1bb5c654fede129
treed8a2c8048aedeca5ab0e6610d0ee7cd39c6269c3
parent7140d08334de7d3c0c1342a0c2eb8a8db638b5df

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.

1 files changed, 4 insertions(+), 0 deletions(-)

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