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: no witness for reachable phi #19678

Closed
ALTree opened this issue Mar 23, 2017 · 11 comments
Closed

cmd/compile: internal compiler error: no witness for reachable phi #19678

ALTree opened this issue Mar 23, 2017 · 11 comments
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Mar 23, 2017

go version devel +e95989c1c1 Thu Mar 23 17:57:25 2017 +0000 linux/amd64

The following program:

package p

var f func(int)

func Crash() {
l1:
	i := 0
	goto l1
l2:
	f(i)
	goto l2
}

crashes the compiler on tip, but not in go1.8 and older.

./2.go:5:6: internal compiler error: no witness for reachable phi v8

goroutine 1 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/alberto/go/src/runtime/debug/stack.go:24 +0x79
cmd/compile/internal/gc.Fatalf(0xace2fc, 0x1f, 0xc420014d70, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/subr.go:175 +0x230
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc4202d87e0, 0x50600000001, 0xace2fc, 0x1f, 0xc420014d70, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:4892 +0x67
cmd/compile/internal/gc.(*state).Fatalf(0xc4200f60e0, 0xace2fc, 0x1f, 0xc420014d70, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:286 +0x98
cmd/compile/internal/gc.(*simplePhiState).insertPhis(0xc4203097e0)
	/home/alberto/go/src/cmd/compile/internal/gc/phi.go:499 +0x4a9
cmd/compile/internal/gc.(*state).insertPhis(0xc4200f60e0)
	/home/alberto/go/src/cmd/compile/internal/gc/phi.go:34 +0x172
cmd/compile/internal/gc.buildssa(0xc4200b2140, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:185 +0x8a3
cmd/compile/internal/gc.compile(0xc4200b2140)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:302 +0x119
cmd/compile/internal/gc.funccompile(0xc4200b2140)
	/home/alberto/go/src/cmd/compile/internal/gc/dcl.go:1172 +0xb7
cmd/compile/internal/gc.Main(0xada2d8)
	/home/alberto/go/src/cmd/compile/internal/gc/main.go:511 +0x230c
main.main()
	/home/alberto/go/src/cmd/compile/main.go:49 +0x95
@josharian
Copy link
Contributor

These are great. Thanks, @ALTree. Out of curiosity, are these from fuzzing with gofuzz, or...?

@josharian josharian added this to the Go1.9 milestone Mar 23, 2017
@josharian
Copy link
Contributor

Anyone want to bisect this?

@ALTree
Copy link
Member Author

ALTree commented Mar 23, 2017

I'm using Dmitry's gosmith (github.com/dvyukov/gosmith).

I've found a few more, but it takes time to reduce them in minimal form.

@josharian
Copy link
Contributor

Cool. It may be easier to reduce them if you bisect first--the commit might help provide clues about which parts are important, and the bisection info is super useful anyway.

Also, cc @mvdan who I believe has been working on an automated reducer. Maybe you could test drive it!

@ALTree
Copy link
Member Author

ALTree commented Mar 24, 2017

This was introduced in 4e42890 (cmd/compile: avoid generating some dead blocks).

@josharian

@mvdan
Copy link
Member

mvdan commented Mar 24, 2017

@josharian I did see this issue, but unfortunately the program has already been reduced (afaik fully) by hand :)

@josharian
Copy link
Contributor

@mvdan I was think of your reducer more for @ALTree's comments: "I've found a few more, but it takes time to reduce them in minimal form."

@mvdan
Copy link
Member

mvdan commented Mar 24, 2017

Ah, sure; current status is available at https://github.com/mvdan/goreduce. See the open issues though, it's missing some important bits like inlining of vars and funcs.

@gopherbot
Copy link

CL https://golang.org/cl/38602 mentions this issue.

@ALTree
Copy link
Member Author

ALTree commented Mar 24, 2017

Nice.

For now we're done: the other 3 I had are actually dups, they just crashed the compiler with different messages. I ran the latest tip on them and they are all fixed.

@josharian
Copy link
Contributor

For now. :) I'm glad you're running it, and I hope you continue to do so; bugs spring eternal, and it's nice to know about them quickly.

@golang golang locked and limited conversation to collaborators Mar 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants