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 2) #29218

Open
ALTree opened this Issue Dec 13, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@ALTree
Copy link
Member

ALTree commented Dec 13, 2018

$ gotip version
go version devel +9eb383e8f0 Thu Dec 13 17:10:32 2018 +0000 linux/amd64

The following program

package p

type T struct {
	b bool
	string
}

func f() {
	var b bool
	var t T
	for {
		switch &t.b {
		case &b:
			if b {
			}
		}
	}
}

crashes the tip compiler with:

$ gotip build crash.go 

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

goroutine 34 [running]:
runtime/debug.Stack(0xf58560, 0xc00000e018, 0x0)
	/home/alberto/go/src/runtime/debug/stack.go:24 +0x9d
cmd/compile/internal/gc.Fatalf(0xdd8845, 0x24, 0xc00052f850, 0x2, 0x2)
	/home/alberto/go/src/cmd/compile/internal/gc/subr.go:190 +0x28b
cmd/compile/internal/gc.(*Liveness).epilogue(0xc0000c4640)
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:1004 +0xc03
cmd/compile/internal/gc.liveness(0xc0004a80f0, 0xc0004ba6e0, 0xc0000c2d90, 0xdc4002, 0x8, 0xde8130)
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:1399 +0xc4
cmd/compile/internal/gc.genssa(0xc0004ba6e0, 0xc0000c2d90)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:5088 +0x92
cmd/compile/internal/gc.compileSSA(0xc0000bc420, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:290 +0x372
cmd/compile/internal/gc.compileFunctions.func2(0xc00049fc20, 0xc0004a0370, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:345 +0x49
created by cmd/compile/internal/gc.compileFunctions
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:343 +0x128

It compiles fine on go1.11.

The crash looks similar to the one in #28445, but the toolchain I'm fuzzing includes the fix for that one.

@ALTree

This comment has been minimized.

Copy link
Member Author

ALTree commented Dec 13, 2018

Tentatively marking as a 1.12 release blocker since it's a new compiler crash on a small and somewhat reasonable program, but leaving to @randall77 to decide if it's ok.

@randall77

This comment has been minimized.

Copy link
Contributor

randall77 commented Dec 15, 2018

It looks like the infinite loop makes it so that the end of the memory state chain is never used, so the entire memory chain is dead-code eliminated. That chain includes VARDEFs for some variables that still have an LEAQ for them. That makes the variables look live on entry.

I'm going to remove release blocker. This can only happen for infinite loops with no reads or writes in them. That seems unlikely to ever happen in real code. At least, non-buggy real code.

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.