-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Can't format u32 values on i386 arch #5087
Comments
Two bugs actually:
|
Are you intentionally targeting |
This likely won't be fixed since Zig doesn't support i386-macosx #1930. |
Ups. My mistake. I'm just messing around kernel stuff - rewriting from c, and problems appears when I want to format string with Here is the repo: https://github.com/fazibear/fazigos Within this file there is The first version of this functions was: pub fn printf(comptime format: []const u8, args: var) void {
var printf_buff: [256]u8 = undefined;
var formatted = fmt.bufPrint(printf_buff[0..], format, args) catch |err| switch (err) {
error.NoSpaceLeft => "xxx",
};
print(formatted);
} But with large values simply throws invalid opcode exception. When I moved print_buff on the top of the file it helps. But when I trying to Right now i'm casting it to |
If you are trying to target freestanding you need to add See https://github.com/jzck/kernel-zig/blob/master/build.zig or https://github.com/markfirmware/zig-bare-metal-raspberry-pi/blob/master/build.zig for example. |
|
@LemonBoy Great answer thanks! Can I disable building with SSE in Still wondering why defining buffer inside function requires SSE, but placing it on the top doesn't ;) |
Check this build.zig. Enabling SSE is IMO better than dealing with x87.
It crashes either way for me while trying to print |
Something has changed in
It's true for 32 bit values but if you try:
It will work, but if you move PS. Still can't enable SSE on qemu. Tries with |
Then check this
You may be triggering other codepaths requiring SSE.
That's osdev stuff and way out of scope for this ticket. |
One moge thing. If 386 on macos is unsupported, maybe the compiler could show nice message about that? |
The standard library tests which include formatting |
Trying to compile:
with
throws error:
Is it a bug?
The text was updated successfully, but these errors were encountered: