Skip to content

cmd/go: internal compiler error: panic: runtime error: index out of range [0] with length 0 on compiling generics code #51813

Closed
@victpork

Description

@victpork

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

Activity

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[/+] on Mar 19, 2022
ALTree

ALTree commented on Mar 19, 2022

@ALTree
Member

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

locked and limited conversation to collaborators on Mar 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @victpork@ALTree@gopherbot

        Issue actions

          cmd/go: internal compiler error: panic: runtime error: index out of range [0] with length 0 on compiling generics code · Issue #51813 · golang/go