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

Closed
ALTree opened this issue Dec 13, 2018 · 5 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@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 ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Dec 13, 2018
@ALTree ALTree added this to the Go1.12 milestone Dec 13, 2018
@ALTree
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
Copy link
Contributor

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.

@randall77 randall77 added NeedsFix The path to resolution is known, but the work has not been done. and removed release-blocker NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 15, 2018
@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/176498 mentions this issue: cmd/compile: move all fuse before branchelim

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/177140 mentions this issue: cmd/compile: process blocks containing only dead values in fuseIf

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/179098 mentions this issue: cmd/compile: process blocks containing only dead values in fuseIf

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants