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: bad live variable at entry (part 3) #32454

ALTree opened this issue Jun 5, 2019 · 2 comments


None yet
3 participants
Copy link

commented Jun 5, 2019

$ gotip version
go version devel +9ab9ca27bb Wed Jun 5 16:33:20 2019 +0000 linux/amd64

This is a follow-up to #29218. On the CL that fixed that one, @josharian wrote:

It is not clear that this fixes every variant of #29218,
but it is a reasonable standalone change.
And code like #29218 is rare and fundamentally buggy,
so we can handle new instances if/when they actually occur.

This is a variant of the reproducer on #29218 that still crashes the tip compiler. The program:

package p

type T struct {
	s string
	f float64

func f() {
	var f float64
	var st T
	for {
		switch &st.f {
		case &f:
			f = 1

The error is the same as in #29218:

$ gotip build crash.go 

# command-line-arguments
<autogenerated>:1: internal compiler error: bad live variable at entry of f: st (type T)

goroutine 37 [running]:
runtime/debug.Stack(0xfd83c0, 0xc000098008, 0x0)
	/home/alberto/go/src/runtime/debug/stack.go:24 +0x9d
cmd/compile/internal/gc.Fatalf(0xe498c8, 0x24, 0xc0004f9758, 0x2, 0x2)
	/home/alberto/go/src/cmd/compile/internal/gc/subr.go:188 +0x291
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:1004 +0xc0e
cmd/compile/internal/gc.liveness(0xc0004d6120, 0xc0004ce420, 0xc0002c6150, 0x0, 0xe3a97a, 0xd)
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:1399 +0xc4
cmd/compile/internal/gc.genssa(0xc0004ce420, 0xc0002c6150)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:5286 +0x92
cmd/compile/internal/gc.compileSSA(0xc0002c4160, 0x3)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:308 +0x3c2
cmd/compile/internal/gc.compileFunctions.func2(0xc0004c34a0, 0xc0004a4230, 0x3)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:363 +0x49
created by cmd/compile/internal/gc.compileFunctions
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:361 +0x128

cc @randall77

@ALTree ALTree added this to the Go1.14 milestone Jun 5, 2019


This comment has been minimized.

Copy link

commented Jun 6, 2019

Continuing the tradition of fixing these bugs indirectly, I have a CL coming shortly that fixes this, but not for any deep reason, and which is independently justifiable. Thanks for continuing to file these, @ALTree; they're productive sources of optimizations. :)


This comment has been minimized.

Copy link

commented Jun 6, 2019

Change mentions this issue: cmd/compile: optimize more pointer comparisons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.