Zig Version
0.11.0-dev.815+88b49ed00
Steps to Reproduce and Observed Behavior
In the following code, the program compiles and runs properly when NB_BITS is 27 or less, but the compilation fails if it is 28 with a relocation problem:
zig build-exe p4.zig
error: ld.lld: p4.o:(function start.posixCallMainAndExit: .text+0x64d): relocation R_X86_64_32S out of range: 2149950032 is not in [-2147483648, 2147483647]
const NB_BITS: u8 = 28;
const std = @import("std");
const stdout = std.io.getStdOut().writer();
const HASH_MASK: u64 = (1 << NB_BITS) - 1;
const HASH_SIZE: usize = 1 << NB_BITS;
var hashes: [HASH_SIZE]u64 = undefined;
fn retrieve(hv: u64) bool {
const ind: usize = (hv & HASH_MASK);
if (hashes[ind] == hv) return true else return false;
}
pub fn main() !void {
for (hashes) |*a| a.* = 0;
if (retrieve(0)) try stdout.print("{d}\n", .{0});
}
Expected Behavior
Correct compilation...
Zig Version
0.11.0-dev.815+88b49ed00
Steps to Reproduce and Observed Behavior
In the following code, the program compiles and runs properly when NB_BITS is 27 or less, but the compilation fails if it is 28 with a relocation problem:
Expected Behavior
Correct compilation...