Zig Version
0.9.0
Steps to Reproduce
Run the following code and observe the generated LLVM IR and asm
const std = @import("std");
pub var arr = blk: {
var x = std.mem.zeroes([10 * 1024]u32);
x[5] = 2;
break :blk x;
};
export fn tester(x : usize) u32 {
return arr[x];
}
Expected Behavior
The following LLVM IR is what Clang generates for similar code:
@arr = dso_local global <{ i32, i32, i32, i32, i32, i32, [10234 x i32] }> <{ i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, [10234 x i32] zeroinitializer }>, align 16
Actual Behavior
The following LLVM IR is generated:
@arr = internal unnamed_addr global [10240 x i32] [i32 0, i32 0, i32 0, i32 0, i32 0, i32 2, <omitting about 10000 i32 0> i32 0,i32 0, i32 0], align 4
Zig Version
0.9.0
Steps to Reproduce
Run the following code and observe the generated LLVM IR and asm
Expected Behavior
The following LLVM IR is what Clang generates for similar code:
Actual Behavior
The following LLVM IR is generated: