zig
zig copied to clipboard
stage2: panic when allocating large PackedIntArray
Zig Version
0.10.0-dev.3383+3cf8f283d
Steps to Reproduce
compile and run this program:
const std = @import("std");
const PackedIntArray = std.PackedIntArray;
pub fn main() !void {
const allocator = std.heap.page_allocator;
var is_prime = try allocator.create(PackedIntArray(u1, 1<<32));
std.log.err("hello, {d}", .{is_prime.get(123456789)});
}
Expected Behavior
It should not panic
Actual Behavior
It panics:
thread 3343588 panic: integer cast truncated bits
???:?:?: 0x20d11d in ??? (???)
???:?:?: 0x20b50e in ??? (???)
???:?:?: 0x20b467 in ??? (???)
???:?:?: 0x20b9d5 in ??? (???)
???:?:?: 0x244390 in ??? (???)
Aborted