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: append outside assignment #31010

Closed
anacrolix opened this Issue Mar 23, 2019 · 3 comments

Comments

Projects
None yet
4 participants
@anacrolix
Copy link
Contributor

anacrolix commented Mar 23, 2019

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

@agnivade agnivade changed the title internal compiler error: append outside assignment cmd/compile: internal compiler error: append outside assignment Mar 23, 2019

@agnivade agnivade added this to the Go1.13 milestone Mar 23, 2019

@mdempsky mdempsky self-assigned this Mar 25, 2019

@mdempsky

This comment has been minimized.

Copy link
Member

mdempsky commented Mar 25, 2019

A similar regression was reported internally within Google. I minimized the test case there to:

package p

var (
	x  int
	xs []int
)

func a([]int) (int, error)

func b() (int, error) {
	return a(append(xs, x))
}

func c(int, error) (int, error)

func d() (int, error) {
	return c(b())
}
@mdempsky

This comment has been minimized.

Copy link
Member

mdempsky commented Mar 25, 2019

Test case fails to reproduce with -l, so I suspect something in inl.go needs updating.

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Mar 25, 2019

Change https://golang.org/cl/169257 mentions this issue: cmd/compile: fix "append outside assignment" ICE

@gopherbot gopherbot closed this in c4f87ed Mar 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.