-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
reached unreachable code compiling zig #22485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Here's the function panicking for convenience. In `lib/std/posix.zig:4666': pub fn mprotect(memory: []align(mem.page_size) u8, protection: u32) MProtectError!void {
if (native_os == .windows) {
const win_prot: windows.DWORD = switch (@as(u3, @truncate(protection))) {
0b000 => windows.PAGE_NOACCESS,
0b001 => windows.PAGE_READONLY,
0b010 => unreachable, // +w -r not allowed
0b011 => windows.PAGE_READWRITE,
0b100 => windows.PAGE_EXECUTE,
0b101 => windows.PAGE_EXECUTE_READ,
0b110 => unreachable, // +w -r not allowed
0b111 => windows.PAGE_EXECUTE_READWRITE,
};
var old: windows.DWORD = undefined;
windows.VirtualProtect(memory.ptr, memory.len, win_prot, &old) catch |err| switch (err) {
error.InvalidAddress => return error.AccessDenied,
error.Unexpected => return error.Unexpected,
};
} else {
switch (errno(system.mprotect(memory.ptr, memory.len, protection))) {
.SUCCESS => return,
.INVAL => unreachable, // panic here
.ACCES => return error.AccessDenied,
.NOMEM => return error.OutOfMemory,
else => |err| return unexpectedErrno(err),
}
}
} |
Thanks to anyone checking this out been stumping me for a bit now |
The compile is failing because |
Thanks a lot. |
Zig Version
0.14.0
Steps to Reproduce and Observed Behavior
sudo dnf install clang-devel llvm-devel lld-devel zlib zlib-devel
.rm -rf build; mkdir build; rm -rf ~/.cache/zig; rm -rf zig-cache; git pull
cd build; cmake .. -DCMAKE_PREFIX_PATH=$(where llvm); make install
Output:
Expected Behavior
Zig builds
The text was updated successfully, but these errors were encountered: