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
cmd/compile: ssa panics on a continue in a switch without a loop #19934
Labels
Milestone
Comments
Confirming the commit above is to blame; its tree panics, its parent's tree does not. Will look around the code in case the fix is somewhat easy. Also not sure how to feel about being the only one who writes garbage code on tip. |
bradfitz
added
the
NeedsFix
The path to resolution is known, but the work has not been done.
label
Apr 11, 2017
mvdan
changed the title
cmd/compile: ssa nil pointer dereference crash on tip
cmd/compile: ssa panics on a continue in a switch without a loop
Apr 11, 2017
Okay, found a fix. Mailing CL with test soon. |
CL https://golang.org/cl/40357 mentions this issue. |
mvdan
removed
the
NeedsFix
The path to resolution is known, but the work has not been done.
label
Apr 12, 2017
lparth
pushed a commit
to lparth/go
that referenced
this issue
Apr 13, 2017
Continues outside of a loop are not allowed. Most of these possibilities were tested in label1.go, but one was missing - a plain continue in a switch/select but no enclosing loop. This used to error with a "continue not in loop" in 1.8, but recently was broken by c03e75e. In particular, innerloop does not only account for loops, but also for switches and selects. Swap it by bools that track whether breaks and continues should be allowed. While at it, improve the wording of errors for breaks that are not where they should be. Change "loop" by "loop, switch, or select" since they can be used in any of those. And add tests to make sure this isn't broken again. Use a separate func since I couldn't get the compiler to crash on f() itself, possibly due to the recursive call on itself. Fixes golang#19934. Change-Id: I8f09c6c2107fd95cac50efc2a8cb03cbc128c35e Reviewed-on: https://go-review.googlesource.com/40357 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Robert Griesemer <gri@golang.org>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?not relevant
What did you do?
Build
f.go
(reduced manually):What did you expect to see?
What Go 1.8.1 gives:
What did you see instead?
Placing my bets on c03e75e by @josharian, will try that version its parent and report back.
The text was updated successfully, but these errors were encountered: