golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.72k stars 17.62k forks source link

cmd/link/internal/ld: panic in deadcode on darwin #69787

Open drew-512 opened 3 weeks ago

drew-512 commented 3 weeks ago

Go version

go1.22.7 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/aomeara/Library/Caches/go-build'
GOENV='/Users/aomeara/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/aomeara/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/aomeara/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.7'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Volumes/HD-2/art.media.platform/amp-sdk-go/go.mod'
GOWORK=''
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/z8/twhq8kc55q79tsq4bgdyh0qm0000gp/T/go-build1674864123=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Using VS code (1.92.2) on macOS Catalina (10.15.7).

Following VSCode UI prompt to install gopls, 100% reproducible. First time on this machine, so can't speak to previous Go versions or regression.

Regression? #33775

What did you see happen?

Installing golang.org/x/tools/gopls@latest FAILED
2024-10-04 15:28:14.724 [info] {
 "code": 1,
 "killed": false,
 "signal": null,
 "cmd": "/usr/local/go/bin/go install -v golang.org/x/tools/gopls@latest",
 "stdout": "",
 "stderr": "# golang.org/x/tools/gopls\npanic: R_USEIFACE in  references golang.org/x/tools/gopls/internal/golang.PackageDocHTML.func9 which is not a type or itab\n\ngoroutine 1 [running]:\ncmd/link/internal/ld.(*deadcodePass).flood(0xc000028900)\n\tcmd/link/internal/ld/deadcode.go:208 +0x12b9\ncmd/link/internal/ld.deadcode(0xc00015a000)\n\tcmd/link/internal/ld/deadcode.go:460 +0xc5\ncmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0xc000012529, 0x1, 0x1}, ...})\n\tcmd/link/internal/ld/main.go:353 +0x1278\nmain.main()\n\tcmd/link/main.go:72 +0xdfb\n"
}
2024-10-04 15:28:14.726 [info] 
2024-10-04 15:28:14.729 [info] 1 tools failed to install.

2024-10-04 15:28:14.729 [info] gopls: failed to install gopls(golang.org/x/tools/gopls@latest): Error: Command failed: /usr/local/go/bin/go install -v golang.org/x/tools/gopls@latest
# golang.org/x/tools/gopls
panic: R_USEIFACE in  references golang.org/x/tools/gopls/internal/golang.PackageDocHTML.func9 which is not a type or itab

goroutine 1 [running]:
cmd/link/internal/ld.(*deadcodePass).flood(0xc000028900)
    cmd/link/internal/ld/deadcode.go:208 +0x12b9
cmd/link/internal/ld.deadcode(0xc00015a000)
    cmd/link/internal/ld/deadcode.go:460 +0xc5
cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0xc000012529, 0x1, 0x1}, ...})
    cmd/link/internal/ld/main.go:353 +0x1278
main.main()
    cmd/link/main.go:72 +0xdfb

What did you expect to see?

gopls compile without issue.

gabyhelp commented 3 weeks ago

Related Issues and Documentation

(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)

cherrymui commented 2 weeks ago

I'm not using macOS 10.15.7 but I cannot reproduce the failure with Go 1.22.7. Could you try clear the build cache, go clean -cache and go clean -modcache? Thanks.