Skip to content

cmd/compile: internal compiler error: bad live variable at entry (part 2) #29218

Closed
@ALTree

Description

@ALTree
$ 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions