-
-
Notifications
You must be signed in to change notification settings - Fork 5.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
type inference bug for multi-cycle functions #9770
Comments
it appears that somehow inference has tricked itself into thinking that
|
@JeffBezanson debug dump:
julia> # huh, that's interesting. while inferring julia> # my resulting hypothesis? all frames between this frame and the top recurred frame need to be marked as recurred, not just those where does that make sense? |
oh, wait. that is what the code doing already. new hypothesis: there are two cycles (overlapping) going on here (at different points in the function). that causes |
xref #9926 |
@JeffBezanson Could you look at this? Segfaulting on perfectly valid julia code is somewhat unfortunate and it looks like there's at least three issues now where this was reported. |
@carnaval and I were discussing ways to fix this. it's possible to do, but requires redesigning inference to be non-recursive. as a side-benefit, that design should be faster at inferring code too. |
note: directly inferring linfo in pure_eval_call is unnecessary since abstract_call_gf_by_type would add this edge anyways and it can be harmful since there was no logic here to prevent unbounded recursion in the type signature fixes #9770
note: directly inferring linfo in pure_eval_call is unnecessary since abstract_call_gf_by_type would add this edge anyways and it can be harmful since there was no logic here to prevent unbounded recursion in the type signature fixes #9770
note: directly inferring linfo in pure_eval_call is unnecessary since abstract_call_gf_by_type would add this edge anyways and it can be harmful since there was no logic here to prevent unbounded recursion in the type signature fixes #9770
I think I might have stumbled across a bug, possibly in type inference though I'm not sure.
I'd expect that running the following would print "ok" 3 times, instead it prints "ok" once then two blank lines.
Making any one of the following changes results in the expected output. Perhaps this will help point someone who understands Julia's internals at the cause of the unexpected behavior.
printit("ok", "foo")
line. (Results in "ok" been printed twice as expected.):sym
line.print("")
line.if
expressions leaving only the non-redundant branch.unknowntype
withunknowntype::ASCIIString
.printit
withinprintit
orid
.I've also just noticed that replacing
println(z)
withprintln(z==nothing ? "nothing" : z)
causes a seg fault.All of this is happening with the latest nightly build, details below. I get very similar results using v0.3.4, but not the seg fault.
The text was updated successfully, but these errors were encountered: