Zig Version
0.15.2
Steps to Reproduce and Observed Behavior
The snippet below is the easiest way i could reproduce the crash
From what i have tested, it does not seem to appear in release builds. Also a singular read into the buffer worked for me, and multiple writes worked fine as well.
Therefore i assume it has to do with the self hosted compiler backend.
I compiled for x86_64 linux.
varbuf:[1<<22]u64=@splat(0);//must be 1 << 22 or higher to crash
pubfnmain()void{// zig run src/main.zig
// Job 1, 'zig run src/main.zig' terminated by signal SIGSEGV (Address boundary error)
varmyVar:u64=0;myVar=buf[0];myVar=buf[0];// does not error if this line is commented out. who knows why
}test"myCrash"{// zig test src/main.zig
// error: the following test command crashed:
// .zig-cache/o/5d8b21efd77ef722dfe83b7cb6fc5a17/test --seed=0x87cebc70
varmyVar:u64=0;myVar=buf[0];myVar=buf[0];}
Expected Behavior
I'd expect either a compiler warning/error for too large arrays or a panic, but rather consistent behavior across debug and release builds
### Zig Version
0.15.2
### Steps to Reproduce and Observed Behavior
The snippet below is the easiest way i could reproduce the crash
From what i have tested, it does **not** seem to appear in release builds. Also a singular read into the buffer worked for me, and multiple writes worked fine as well.
Therefore i assume it has to do with the self hosted compiler backend.
I compiled for x86_64 linux.
```zig
var buf: [1 << 22]u64 = @splat(0); //must be 1 << 22 or higher to crash
pub fn main() void {
// zig run src/main.zig
// Job 1, 'zig run src/main.zig' terminated by signal SIGSEGV (Address boundary error)
var myVar: u64 = 0;
myVar = buf[0];
myVar = buf[0]; // does not error if this line is commented out. who knows why
}
test "myCrash" {
// zig test src/main.zig
// error: the following test command crashed:
// .zig-cache/o/5d8b21efd77ef722dfe83b7cb6fc5a17/test --seed=0x87cebc70
var myVar: u64 = 0;
myVar = buf[0];
myVar = buf[0];
}
```
### Expected Behavior
I'd expect either a compiler warning/error for too large arrays or a panic, but rather consistent behavior across debug and release builds