Skip to content

x/tools/go/pointer: internal error in pointer analysis: node has no enclosing object #58801

@BarrensZeppelin

Description

@BarrensZeppelin

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

$ go version
go version go1.20.1 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/zii/.cache/go-build"
GOENV="/home/zii/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/zii/gopath/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/zii/gopath"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/snap/go/10055"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/snap/go/10055/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1802674291=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Running the pointer analysis on a docker package as described in https://github.com/BarrensZeppelin/go-pointer-analysis-bug yields the following panic:

Internal panic in pointer analysis:
goroutine 1 [running]:
runtime/debug.Stack()
	/snap/go/10055/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
	/snap/go/10055/src/runtime/debug/stack.go:16 +0x19
golang.org/x/tools/go/pointer.Analyze.func1()
	/home/zii/tmp/moby/gopath/src/golang.org/x/tools/go/pointer/analysis.go:225 +0xca
panic({0x6785a0, 0x729880})
	/snap/go/10055/src/runtime/panic.go:884 +0x213
golang.org/x/tools/go/pointer.(*analysis).enclosingObj(...)
	/home/zii/tmp/moby/gopath/src/golang.org/x/tools/go/pointer/analysis.go:157
golang.org/x/tools/go/pointer.(*hvn).markIndirectNodes(0x6b8380?)
	/home/zii/tmp/moby/gopath/src/golang.org/x/tools/go/pointer/hvn.go:483 +0x338
golang.org/x/tools/go/pointer.(*analysis).hvn(0xc0589dec00)
	/home/zii/tmp/moby/gopath/src/golang.org/x/tools/go/pointer/hvn.go:279 +0x2e5
golang.org/x/tools/go/pointer.Analyze(0xc033b9d810)
	/home/zii/tmp/moby/gopath/src/golang.org/x/tools/go/pointer/analysis.go:321 +0xc86
main.main()
	/home/zii/tmp/moby/main.go:58 +0x707
Failed pointer analysis
internal error in pointer analysis: node has no enclosing object (please report this bug)
exit status 1

If no queries are added to the analysis configuration the panic does not occur.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions