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/go: internal compiler error: panic: runtime error: index out of range [0] with length 0 on compiling generics code #51813

Closed
victpork opened this issue Mar 19, 2022 · 1 comment

Comments

@victpork
Copy link

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

1.18.0

$ go version
go1.18 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/runner/.cache/go-build"
GOENV="/home/runner/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/runner/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/runner/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/hostedtoolcache/go/1.18.0/x64"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/hostedtoolcache/go/1.18.0/x64/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/runner/work/go-radix/go-radix/go.mod"
GOWORK=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3140959091=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Trying to convert https://github.com/armon/go-radix into version supporting generics. Changed all interface{} types into generics, adding a generic "return nil" function.

https://go.dev/play/p/alc4b8f2kaj or https://github.com/victpork/go-radix

What did you expect to see?

Expecting to either compile successfully or compiler complains code syntax instead of crashes.

What did you see instead?

./prog.go:124:11: internal compiler error: panic: runtime error: index out of range [0] with length 0

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
@victpork victpork changed the title affected/package: internal compiler error: panic: runtime error: index out of range [0] with length 0 on compiling generics code cmd/go: internal compiler error: panic: runtime error: index out of range [0] with length 0 on compiling generics code Mar 19, 2022
@ALTree
Copy link
Member

ALTree commented Mar 19, 2022

Thanks for reporting this, I think that's the same issue described in #51765 (stacktrace looks similar). I'm closing here as a dup.

@ALTree ALTree closed this as completed Mar 19, 2022
@golang golang locked and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants