-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
TimerUnsupported in release builds #12776
Comments
I'm assuming your issue is with the stage1 compiler since this didn't compile with stage2 without a few fixes but with them it now works as expected. Also note that it doesn't make much sense to packed struct here, at least not with stage2. |
I don't know what stage1 or stage2 is ^^;;
I am curious what didn't work
The original app (code now deleted) had (in the past) a reason to use it - but now that I check, it doesn't any more (all of the attributes which needed packing got moved to an internal packed struct). While removing "packed" from this minimal example fixes it, if I removed "packed" from the real app's CPU struct (leaving the internal packed struct, which is required), I then get a segfault instead, so that doesn't work as a workaround :( I don't know if the segfault when using an internal packed struct is the same or a different bug to the |
stage1 is the bootstrap compiler, stage2 is the self hosted compiler. The version you are using should use the self hosted compiler by default which wasn't able to handle this yet so I'm not quite sure how you managed to run that example without
Just a few small missed conditions in codegen, you can check the linked commit for more information if you're curious.
I can't say for sure but this case works properly now at least. |
Well that's interesting - for me, stage1 can't compile it, but stage2 compiles (with errors in release mode): Debug, stage1: compiler error
Debug, stage2: works
Release, stage1: compiler error
Release, stage2: broken binary
Awesome, thank you :) I will try that, and then also try removing the now-redundant "packed", and open a new issue if that other crash is still happening |
May I ask too? |
Your stage1/stage2 is reversed somehow, where did you get your Zig binary? |
Yes, by default builds from ziglang.org/download use the self hosted backend stage2 (well actually stage3 which is stage2 built with stage2) but you can also opt for the old C++ bootstrap compiler stage1 with |
Thanks, that's good to know |
using brew's "compile from master branch" script, specifically |
Now I suggest that #10873 is stage2? Since version is 0.10.0-dev.358+36f13f591? |
No, that is stage1. Stage2 doesn't allow arrays in packed structs and has only been the default since around 0.10.0-dev.3800. |
I am on windows, Zig Version 0.10.1 and var timer = try std.time.Timer.start(); is still producing a TimerUnsupported Error |
Zig Version
0.10.0-dev.3884+11d14a23a
Steps to Reproduce
(I'm pretty sure that this is some kind of weird memory corruption issue, but I don't know what the heck is happening, so I've used the most obvious symptom as the issue title)
Given this test case (coming from a real app, where I've deleted as much as possible while still reproducing the issue):
Debug build works:
Release build crashes with a really random error:
And if I delete code after the line that crashes, the error also disappears
In case this is some weird CPU-specific memory corruption issue -- I'm using an M1 MacBook Pro
Expected Behavior
Debug and Release builds should both work
Actual Behavior
Release build appears to crash in mysterious ways
Also, if I update the main function to be:
Then the addition of print statements appears to trigger a very different error:
Is it possible that something in CPU.tick() is corrupting the memory (something to do with packed structs?), and somehow this is being mis-attributed to TimerUnsupported??
The text was updated successfully, but these errors were encountered: