Skip to content
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: panic during fuse with if true block containing a goto and a return #28616

Closed
helloPiers opened this issue Nov 6, 2018 · 6 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@helloPiers
Copy link
Contributor

helloPiers commented Nov 6, 2018

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Reproduces on playground, master branch, and Go v1.11.2.
Doesn't reproduce on Go v1.10.5.

What did you do?

Tried to compile code which I've boiled down to:
https://play.golang.org/p/2fEsQtceadQ

What did you expect to see?

Compilation success

What did you see instead?

prog.go:5:2: internal compiler error: 'f1': panic during fuse while compiling f1:

runtime error: index out of range

goroutine 20 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc000403218, 0xc00034c6e0)
	/usr/local/go/src/cmd/compile/internal/ssa/compile.go:38 +0xc6
panic(0xc445e0, 0x12dc7e0)
	/usr/local/go/src/runtime/panic.go:513 +0x1b9
cmd/compile/internal/ssa.fuseBlockPlain(0xc0003dfce8, 0x47be00)
	/usr/local/go/src/cmd/compile/internal/ssa/fuse.go:123 +0x781
...
@ianlancetaylor ianlancetaylor changed the title compiler: panic during fuse with if true block containing a goto and a return cmd/compile: panic during fuse with if true block containing a goto and a return Nov 6, 2018
@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Nov 6, 2018
@ianlancetaylor ianlancetaylor added this to the Go1.12 milestone Nov 6, 2018
@ianlancetaylor
Copy link
Contributor

CC @randall77

@ianlancetaylor
Copy link
Contributor

@gopherbot please open a backport for 1.11

@gopherbot
Copy link

Backport issue(s) opened: #28617 (for 1.11).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases.

@randall77
Copy link
Contributor

@quasilyte I believe your CL https://go-review.googlesource.com/c/go/+/91056 is the cause.
In cmd/compile/internal/gc/typecheck.go:deadcode, we remove everything from a function after an if true { ... return } pattern. But we can't do that if, inside that if, there is a goto to a label which occurs after the if.

@gopherbot
Copy link

Change https://golang.org/cl/147817 mentions this issue: cmd/compile: don't deadcode eliminate labels

@quasilyte
Copy link
Contributor

quasilyte commented Nov 6, 2018

@randall77, thanks for quickly fixing it.
My mistake without a doubt.

@helloPiers, thanks for reporting it! 👍

@golang golang locked and limited conversation to collaborators Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

5 participants