-
-
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
Zig stage2 erroneous backwards branch evaluation/segfault with recursive function #13013
Comments
Duplicate of #12973 |
I'm not sure this is a duplicate of #12973, since I think we're missing "error: parameter of type 'fn (i8) bool' must be declared comptime" @jwhear The example works if you update the function pointer for stage2: pub fn stablePartition(comptime T: type, slice: []T, predicate: std.meta.FnPtr(fn(T) bool)) i8
|
Ah, good catch. I distantly remember reading this in the transition guide a while ago, but had forgotten all about it. Using |
@Vexu with |
The original example works when converting the test into an exported function but the version with a test hits an assertion failure. |
Strange, since I ran All 1 tests passed. I'm on Linux. |
My mistake, I wasn't using master branch. It does compile now but probably shouldn't as noted by topolarity above. |
Zig Version
0.10.0-dev.4198+5e0d8a435
Steps to Reproduce
Run
zig test
on the following code (heavily reduced to minimize surface area):By default this produces the following error:
Using
@setEvalBranchQuota(5000)
as suggested causes the compiler to crash on my machine. Note that this is during compilation, not runtime.Expected Behavior
Running
zig test -fstage1 min.zig
compiles and runs successfully with all tests passing.Actual Behavior
Backwards branches error or segfault if the branch quota is increased. There appears to be some kind of infinite recursion, perhaps in type inference/resolution.
The text was updated successfully, but these errors were encountered: