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: internal compiler error: panic during short circuit #45947

Closed
ALTree opened this issue May 4, 2021 · 2 comments
Closed

cmd/compile: internal compiler error: panic during short circuit #45947

ALTree opened this issue May 4, 2021 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented May 4, 2021

$ gotip version
go version devel go1.17-da7496d841 Tue May 4 17:37:39 2021 +0000 linux/amd64
package p

func f() {
	_ = func() func() {
		return func() {
		l:
			goto l
		}
	}()
}
$ gotip tool compile crash.go

crash.go:9:3: internal compiler error: 'f.func2': panic during short circuit while compiling f.func2:

runtime error: index out of range [0] with length 0

goroutine 9 [running]:
cmd/compile/internal/ssa.Compile.func1()
	/home/alberto/go/src/cmd/compile/internal/ssa/compile.go:48 +0x71
panic({0xcb8f80, 0xc000026b10})
	/home/alberto/go/src/runtime/panic.go:1038 +0x215
cmd/compile/internal/ssa.fuseBlockPlain(0x725c20)
	/home/alberto/go/src/cmd/compile/internal/ssa/fuse.go:178 +0x554
cmd/compile/internal/ssa.fuse(0xc00037dd40, 0x11)
	/home/alberto/go/src/cmd/compile/internal/ssa/fuse.go:41 +0x19d
cmd/compile/internal/ssa.shortcircuit(0xc00037dd40)
	/home/alberto/go/src/cmd/compile/internal/ssa/shortcircuit.go:61 +0x85
cmd/compile/internal/ssa.Compile(0xc00037dd40)
	/home/alberto/go/src/cmd/compile/internal/ssa/compile.go:96 +0x9e7
cmd/compile/internal/ssagen.buildssa(0xc00013ab00, 0x0)
	/home/alberto/go/src/cmd/compile/internal/ssagen/ssa.go:642 +0x1ddd
cmd/compile/internal/ssagen.Compile(0xc00013ab00, 0x0)
	/home/alberto/go/src/cmd/compile/internal/ssagen/pgen.go:165 +0x4c
cmd/compile/internal/gc.compileFunctions.func2.1()
	/home/alberto/go/src/cmd/compile/internal/gc/compile.go:136 +0x65
created by cmd/compile/internal/gc.compileFunctions.func2
	/home/alberto/go/src/cmd/compile/internal/gc/compile.go:134 +0xcf

The program compiles fine in Go1.16.

Reduced from a gosmith crasher.

cc @mdempsky

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 4, 2021
@ALTree ALTree added this to the Go1.17 milestone May 4, 2021
@mdempsky
Copy link
Member

mdempsky commented May 4, 2021

Seems like another case of inlining and function closures.

/cc @danscales

@gopherbot
Copy link

Change https://golang.org/cl/316931 mentions this issue: cmd/compile: do not substitute OGOTO inside a closure when inlining

@golang golang locked and limited conversation to collaborators May 5, 2022
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.
Projects
None yet
Development

No branches or pull requests

3 participants