Open trgwii opened 1 year ago
Here are some of my earlier attempts before I managed to reduce this example (these also all segfault):
threadlocal var foo = true;
pub fn main() void {
const x = comptime foo;
_ = x;
}
var foo = true;
pub fn main() void {
const x = comptime foo;
_ = x;
}
The assertion failure happens in Liveness.zig
and using -fstrip
or -fno-emit-bin
avoids it.
If I print x
, it still segfaults on build with -fstrip
:
const std = @import("std");
pub fn main() void {
var foo = true;
foo = false;
const x = comptime foo;
std.debug.print("{}\n", .{x});
}
$ zig build-exe -fstrip bug.zig
Segmentation fault
All examples still segfault the compiler on 0.12.0-dev.3193+4ba4f94c9
Zig Version
0.12.0-dev.1664+8ca4a5240
Steps to Reproduce and Observed Behavior
Expected Behavior
I expect some kind of compile error