Skip to content

cmd/compile: internal compiler error: append outside assignment #31010

Closed
@anacrolix

Description

@anacrolix

What version of Go are you using (go version)?

$ go version
go version devel +1257d05088 Fri Mar 22 21:19:22 2019 +0000 darwin/amd64

Does this issue reproduce with the latest release?

Not with go 1.12.1.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/anacrolix/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/anacrolix/go"
GOPROXY=""
GORACE=""
GOROOT="/Users/anacrolix/src/go.master"
GOTMPDIR=""
GOTOOLDIR="/Users/anacrolix/src/go.master/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/anacrolix/go/src/github.com/anacrolix/webtorrent/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rx/s8fbr8m17nvg88dq7lkblhz00000gn/T/go-build224775436=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

"github.com/anacrolix/missinggo/slices"
"github.com/garyburd/redigo/redis"
...
ret, err := redis.Strings(rc.Do(
		"hmget",
		append([]interface{}{"torrent:name"}, slices.ToEmptyInterface(ihHexes)...)...,
	))

I tried to create a minimal example, but it doesn't fail:

package main
type T = interface{}
func f(t T, ts ...T) {}
func rest() []T {return []T{nil}}
func main() {
	f(nil,append([]T{nil}, rest()...)...)
}

It may be related to the reflect stuff in slices.ToEmptyInterface, or less deterministic results from rest.

What did you expect to see?

Successful compile

What did you see instead?

At the append above, with the relevant imports:

internal compiler error: append outside assignment

goroutine 1 [running]:
runtime/debug.Stack(0x1c36000, 0xc00009a000, 0x0)
	/Users/anacrolix/src/go.master/src/runtime/debug/stack.go:24 +0x9d
cmd/compile/internal/gc.Fatalf(0x1a94cec, 0x19, 0x0, 0x0, 0x0)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/subr.go:190 +0x293
cmd/compile/internal/gc.walkexpr(0xc000a5a480, 0xc002554750, 0xc00121e900)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:1163 +0x7fb
cmd/compile/internal/gc.walkexprlist(0xc0004e3fc0, 0x2, 0x2, 0xc002554750)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:365 +0x50
cmd/compile/internal/gc.walkCall(0xc000a5a300, 0xc002554750)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:1748 +0xc4
cmd/compile/internal/gc.walkexpr(0xc000a5a300, 0xc002554750, 0x2)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:599 +0x3bc4
cmd/compile/internal/gc.walkexpr(0xc00121ea00, 0xc002554750, 0x2)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:700 +0x250d
cmd/compile/internal/gc.walkstmt(0xc00121ea00, 0xc00218b3b0)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:159 +0xdca
cmd/compile/internal/gc.walkstmtlist(0xc001184d18, 0x1, 0x1)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:79 +0x46
cmd/compile/internal/gc.walkexpr(0xc000a5a200, 0xc002555598, 0x2)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:452 +0xbb
cmd/compile/internal/gc.walkexpr(0xc000a5a180, 0xc002555598, 0x0)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:700 +0x250d
cmd/compile/internal/gc.walkstmt(0xc000a5a180, 0xc001bcd100)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:159 +0xdca
cmd/compile/internal/gc.walkstmtlist(0xc001bcd200, 0xd, 0x10)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:79 +0x46
cmd/compile/internal/gc.walk(0xc000a53080)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/walk.go:63 +0x3ec
cmd/compile/internal/gc.compile(0xc000a53080)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/pgen.go:235 +0x80
cmd/compile/internal/gc.funccompile(0xc000a53080)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/pgen.go:221 +0xc2
cmd/compile/internal/gc.Main(0x1aabc38)
	/Users/anacrolix/src/go.master/src/cmd/compile/internal/gc/main.go:665 +0x3047
main.main()
	/Users/anacrolix/src/go.master/src/cmd/compile/main.go:51 +0xad

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