Skip to content

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

Closed
@ALTree

Description

@ALTree
$ 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
cmd/compile/internal/gc.(*Liveness).epilogue(0xc0002c8500)
	/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions