Skip to content

cmd/compile: internal compiler error: expected branch at write barrier block #25516

Closed
@ALTree

Description

@ALTree
$ gotip version
go version devel +1174ad3a8f Wed May 23 09:44:27 2018 +0000 linux/amd64

The following program:

package p

func f() {
	var I0 int
	var AB0 []bool
	var S0 string
	var AS1 []string
	for true {
		if AB0[I0] {
			var AS2 []string
			S0 = AS2[len(S0)]
			I0 = 0
		}
		AS1 = []string{"hi"}
	}
	_ = AS1
}

crashes the tip compiler with the following error:

$ gotip build test.go
# command-line-arguments
./test.go:8:2: internal compiler error: expected branch at write barrier block b4

goroutine 5 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/alberto/go/src/runtime/debug/stack.go:24 +0xa7
cmd/compile/internal/gc.Fatalf(0xcba1fd, 0x29, 0xc0004fc1c0, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/subr.go:182 +0x1f7
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc0004ec000, 0x802100000002, 0xcba1fd, 0x29, 0xc0004fc1c0, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:5537 +0x67
cmd/compile/internal/ssa.(*Func).Fatalf(0xc0004ee000, 0xcba1fd, 0x29, 0xc0004fc1c0, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/ssa/func.go:562 +0x73
cmd/compile/internal/gc.(*Liveness).markUnsafePoints(0xc0004ee840)
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:703 +0x6f1
cmd/compile/internal/gc.newliveness(0xc00037a000, 0xc0004ee000, 0x0, 0x0, 0x0, 0xc0004ec9c0, 0x0, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:565 +0x9eb
cmd/compile/internal/gc.liveness(0xc0004ec000, 0xc0004ee000, 0x0, 0x0, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/plive.go:1696 +0x95
cmd/compile/internal/gc.genssa(0xc0004ee000, 0xc000510700)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:4774 +0xbe
cmd/compile/internal/gc.compileSSA(0xc00037a000, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:267 +0x179
cmd/compile/internal/gc.compileFunctions.func2(0xc000052b40, 0xc0000162f0, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:309 +0x49
created by cmd/compile/internal/gc.compileFunctions
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:307 +0x11a

It compiles fine on go1.10.1

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.release-blocker

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions