-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed as duplicate of#21463
Closed as duplicate of#21463
Copy link
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior
Description
Zig Version
0.14.1
Steps to Reproduce and Observed Behavior
const Test = packed struct {
ptr: *usize,
fn init() Test {
return Test{
.ptr = @ptrFromInt(0x04000000),
};
}
};
var t: Test = undefined;
pub fn main() void {
t = Test.init();
}
This code fails to compile on Windows 11 but compiles just fine on Mac, same 0.14.1 version of the compiler.
The error seems to be caused by the packed attribute, without it there's no issue.
Error message:
C:\Users\<username>\scoop\apps\zig\0.14.1\zig.exe build-exe -ODebug -Mroot=C:\Users\<username>\Desktop\zigbug\src\main.zig --cache-dir C:\Users\<username>\Desktop\zigbug\.zig-cache --global-cache-dir C:\Users\<username>\AppData\Local\zig --name bug_example --zig-lib-dir C:\Users\<username>\scoop\apps\zig\0.14.1\lib\ --listen=-
install
└─ install bug_example
└─ zig build-exe bug_example Debug native failure
error: the following command exited with error code 3:
C:\Users\<username>\scoop\apps\zig\0.14.1\zig.exe build-exe -ODebug -Mroot=C:\Users\<username>\Desktop\zigbug\src\main.zig --cache-dir C:\Users\<username>\Desktop\zigbug\.zig-cache --global-cache-dir C:\Users\<username>\AppData\Local\zig --name bug_example --zig-lib-dir C:\Users\<username>\scoop\apps\zig\0.14.1\lib\ --listen=-
Build Summary: 0/3 steps succeeded; 1 failed
install transitive failure
└─ install bug_example transitive failure
└─ zig build-exe bug_example Debug native failure
error: the following build command failed with exit code 1:
C:\Users\<username>\Desktop\zigbug\.zig-cache\o\7321ba064b3b2d7568f2014a47a4a1a5\build.exe C:\Users\<username>\scoop\apps\zig\0.14.1\zig.exe C:\Users\<username>\scoop\apps\zig\0.14.1\lib C:\Users\<username>\Desktop\zigbug C:\Users\<username>\Desktop\zigbug\.zig-cache C:\Users\<username>\AppData\Local\zig --seed 0xf239d964 -Zc045b5e11bd18639 --verbose
Expected Behavior
Successful compile on Windows.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behavior