Skip to content

cmd/link: slice bounds out of range #62098

Closed
@swtch1

Description

@swtch1

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

$ go version
go version go1.21.0 darwin/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='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users//Library/Caches/go-build'
GOENV='/Users//Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users//go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users//go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.21.0/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.21.0/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='/Users//code///go.mod'
GOWORK='/Users//code//go.work'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/hy/sxcwypzn0h9bg08bpjz789y00000gn/T/go-build2316893392=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

cd project
go run .

The same thing happens with go build ..

What did you expect to see?

My program running the same way it did on 1.20

What did you see instead?

# gitlab.com/<org>/<repo>/<project>
panic: runtime error: slice bounds out of range [74:69]

goroutine 1 [running]:
cmd/link/internal/ld.typeSymbolMangle({0x49ac657b, 0x4f})
        /usr/local/Cellar/go/1.21.0/libexec/src/cmd/link/internal/ld/lib.go:1012 +0x379
cmd/link/internal/ld.(*Link).mangleTypeSym(0xc000110000)
        /usr/local/Cellar/go/1.21.0/libexec/src/cmd/link/internal/ld/lib.go:959 +0xb9
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0xc0000ae2e9, 0x1, 0x1}, ...})
        /usr/local/Cellar/go/1.21.0/libexec/src/cmd/link/internal/ld/main.go:308 +0x124b
main.main()
        /usr/local/Cellar/go/1.21.0/libexec/src/cmd/link/main.go:72 +0xdfb

I have confirmed that a simple hello world program does work so there must be something specific to the code or project environment.

I searched for the same issue and found #61060 but this seemed too different to lump in with that, and it's happening on the latest release.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions