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

x/tools/go/ssa: unexpected container type in IndexExpr #52834

Closed
zpavlinovic opened this issue May 10, 2022 · 5 comments
Closed

x/tools/go/ssa: unexpected container type in IndexExpr #52834

zpavlinovic opened this issue May 10, 2022 · 5 comments
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@zpavlinovic
Copy link
Contributor

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

$ go version
go version go1.18.1 linux/amd64

Does this issue reproduce with the latest release?

The hash commit of the x/tools version is ddadc42. It should also reproduce with the newest version of tools.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/go/src/team.git.corp.google.com/deepgo/wp/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-build5831328=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Load ./... packages of https://github.com/cri-o/cri-o.git using x/tools/ssa with BuilderMode(0).

What did you expect to see?

Successful building with no failures and crashes.

What did you see instead?

panic: unexpected container type in IndexExpr: func[T any]() *[capnproto.org/go/capnp/v3/internal/mpsc.Queue[T]](https://www.google.com/url?q=http://capnproto.org/go/capnp/v3/internal/mpsc.Queue%5BT%5D&sa=D)

goroutine 22087 [running]:
[golang.org/x/tools/go/ssa.(*builder).expr0(0xc097511df0](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).expr0(0xc097511df0&sa=D), 0xc08b27d860, {0x78dff0?, 0xc01c0a7cb0?}, {0x7, {0x78d4f8, 0xc018b38c00}, {0x0, 0x0}})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:907](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:907) +0x24d9
[golang.org/x/tools/go/ssa.(*builder).expr(0xc097510888](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).expr(0xc097510888&sa=D)?, 0xc08b27d860, {0x78dff0?, 0xc01c0a7cb0?})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:610](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:610) +0x18e
[golang.org/x/tools/go/ssa.(*builder).setCallFunc(0x7f9375e1da68](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).setCallFunc(0x7f9375e1da68&sa=D)?, 0x80?, 0xc000042800?, 0xc0a56c3cc0)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1022](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1022) +0x3ea
[golang.org/x/tools/go/ssa.(*builder).setCall(0x6cb400](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).setCall(0x6cb400&sa=D)?, 0xc024771e00?, 0xc00ea1f8c0, 0xc0a56c3cc0)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1101](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1101) +0x34
[golang.org/x/tools/go/ssa.(*builder).expr0(0xc097511df0](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).expr0(0xc097511df0&sa=D), 0xc08b27d860, {0x78dc30?, 0xc00ea1f8c0?}, {0x7, {0x78d4d0, 0xc022bac280}, {0x0, 0x0}})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:686](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:686) +0x2831
[golang.org/x/tools/go/ssa.(*builder).expr(0x0](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).expr(0x0&sa=D)?, 0xc08b27d860, {0x78dc30?, 0xc00ea1f8c0?})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:610](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:610) +0x18e
[golang.org/x/tools/go/ssa.(*builder).assign(0xc08b27d860](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).assign(0xc08b27d860&sa=D)?, 0x78fe58?, {0x78e830?, 0xc0a56cf230}, {0x78dc30?, 0xc00ea1f8c0?}, 0x8e?, 0xc097511198)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:583](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:583) +0x3db
[golang.org/x/tools/go/ssa.(*builder).compLit(0xc08b27d860](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).compLit(0xc08b27d860&sa=D)?, 0x78d4a8?, {0x78f900, 0xc0a56d6c60}, 0xc00ea1f980, 0x1, 0xc097511198)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1268](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1268) +0xb4b
[golang.org/x/tools/go/ssa.(*builder).addr(0x203029](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).addr(0x203029&sa=D)?, 0xc08b27d860, {0x78dcf0?, 0xc00ea1f980}, 0x1)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:438](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:438) +0x1bc
[golang.org/x/tools/go/ssa.(*builder).expr0(0xc097511df0](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).expr0(0xc097511df0&sa=D), 0xc08b27d860, {0x78e380?, 0xc001b5de60?}, {0x7, {0x78d4d0, 0xc022bac2b0}, {0x0, 0x0}})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:693](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:693) +0xf1
[golang.org/x/tools/go/ssa.(*builder).expr(0xc0a56a56e8](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).expr(0xc0a56a56e8&sa=D)?, 0xc08b27d860, {0x78e380?, 0xc001b5de60?})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:610](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:610) +0x18e
[golang.org/x/tools/go/ssa.(*builder).assign(0xc08b27d860](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).assign(0xc08b27d860&sa=D)?, 0xc08b27d860?, {0x78e830?, 0xc0a56cf0e0}, {0x78e380?, 0xc001b5de60?}, 0xe0?, 0xc0975116f0)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:583](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:583) +0x3db
[golang.org/x/tools/go/ssa.(*builder).assignStmt(0xc0a56c1cf0](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).assignStmt(0xc0a56c1cf0&sa=D)?, 0xc08b27d860, {0xc01acae510, 0x1, 0xc?}, {0xc01acae5d0, 0x1, 0x8?}, 0x1)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1186](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:1186) +0x25d
[golang.org/x/tools/go/ssa.(*builder).stmt(0xc097511918](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).stmt(0xc097511918&sa=D)?, 0xc08b27d860, {0x78dab0?, 0xc00ea1f9c0?})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2142](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2142) +0x734
[golang.org/x/tools/go/ssa.(*builder).stmtList(0x7f9346d8ee01](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).stmtList(0x7f9346d8ee01&sa=D)?, 0xc0a56ceff0?, {0xc024276380?, 0x6, 0xc000042800?})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:921](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:921) +0x67
[golang.org/x/tools/go/ssa.(*builder).stmt(0xc08b27d860](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).stmt(0xc08b27d860&sa=D)?, 0xc08b27d860, {0x78dbd0?, 0xc01c0a7e30?})
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2238](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2238) +0x9d1
[golang.org/x/tools/go/ssa.(*builder).buildFunctionBody(0x5b7bb1](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).buildFunctionBody(0x5b7bb1&sa=D)?, 0xc08b27d860)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2347](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2347) +0x472
[golang.org/x/tools/go/ssa.(*builder).buildFunction(0x5b7c00](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).buildFunction(0x5b7c00&sa=D)?, 0xc08b27d860)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2287](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2287) +0x2e
[golang.org/x/tools/go/ssa.(*builder).buildCreated(0xc097511df0)](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*builder).buildCreated(0xc097511df0)&sa=D)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2369](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2369) +0x25
[golang.org/x/tools/go/ssa.(*Package).build(0xc08b0eb780)](https://www.google.com/url?q=http://golang.org/x/tools/go/ssa.(*Package).build(0xc08b0eb780)&sa=D)
	/go/src/[team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2549](http://team.git.corp.google.com/deepgo/wp/third_party/x/tools/go/ssa/builder.go:2549) +0xca5
@zpavlinovic zpavlinovic added the Analysis Issues related to static analysis (vet, x/tools/go/analysis) label May 10, 2022
@zpavlinovic zpavlinovic added this to the Unreleased milestone May 10, 2022
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 10, 2022
@zpavlinovic
Copy link
Contributor Author

@timothy-king

@timothy-king
Copy link
Contributor

I am not yet able to reproduce from the given instructions. Also the stack looks like it is for deepgo. Maybe email me reproducer instructions and I can minimize from there?

@timothy-king
Copy link
Contributor

From builder.go:

	case *ast.IndexExpr:
		if ident, ok := e.X.(*ast.Ident); ok {
			if _, ok := typeparams.GetInstances(fn.info)[ident]; ok {
				// If the IndexExpr is an instantiation, it will be handled by the *Ident case.
				return b.expr(fn, ident)
			}
		}

This is ignoring when e.X is a *go/ast.SelectorExpr. Looking into a fix.

@timothy-king timothy-king self-assigned this May 11, 2022
@gopherbot
Copy link

Change https://go.dev/cl/405555 mentions this issue: x/tools/go/ssa: fix *SelectorExpr within *IndexExpr handling

yarcat added a commit to yarcat/text that referenced this issue Aug 9, 2022
go get -u golang.org/x/tools
go mod tidy

x/tools/go/ssa is used by message/pipeline. The version 0.1.11 required
contained an issue related to generics, when generics instantiation was
confused with container index. However, x/tools/go/ssa does have it fixed
at head (see golang/go#52834). This change upgrades the required version
to ensure less users of message/pipelines have issues.

For golang/go#54086
@gopherbot
Copy link

Change https://go.dev/cl/422414 mentions this issue: go.mod: update x/tools to HEAD

yarcat added a commit to yarcat/text that referenced this issue Aug 12, 2022
go get -u golang.org/x/tools
go mod tidy

x/tools/go/ssa is used by message/pipeline. Generics instantiation in
x/tools@0.1.11 could be confused with container index. However,
x/tools/go/ssa does have it fixed in x/tools@0.1.12 (see golang/go#52834).
This change upgrades the required version to ensure that fewer users of
message/pipelines have issues.

Updates golang/go#54086
yarcat added a commit to yarcat/text that referenced this issue Aug 12, 2022
go get -u golang.org/x/tools
go mod tidy

x/tools/go/ssa is used by message/pipeline. Generics instantiation in
x/tools@0.1.11 could be confused with container index. However,
x/tools/go/ssa does have it fixed in x/tools@0.1.12 (see golang/go#52834).
This change upgrades the required version to ensure that fewer users of
message/pipelines have issues.

Updates golang/go#54086
gopherbot pushed a commit to golang/text that referenced this issue Aug 12, 2022
go get -u golang.org/x/tools
go mod tidy

x/tools/go/ssa is used by message/pipeline. Generics instantiation in
x/tools@0.1.11 could be confused with container index. However,
x/tools/go/ssa does have it fixed in x/tools@0.1.12 (see golang/go#52834).
This change upgrades the required version to ensure that fewer users of
message/pipelines have issues.

Updates golang/go#54086

Change-Id: I03882a7bb2c75a8f16ef376d06f2cf714d39e7a2
GitHub-Last-Rev: 351404b
GitHub-Pull-Request: #32
Reviewed-on: https://go-review.googlesource.com/c/text/+/422414
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
xhit pushed a commit to xhit/text that referenced this issue Oct 10, 2022
go get -u golang.org/x/tools
go mod tidy

x/tools/go/ssa is used by message/pipeline. Generics instantiation in
x/tools@0.1.11 could be confused with container index. However,
x/tools/go/ssa does have it fixed in x/tools@0.1.12 (see golang/go#52834).
This change upgrades the required version to ensure that fewer users of
message/pipelines have issues.

Updates golang/go#54086

Change-Id: I03882a7bb2c75a8f16ef376d06f2cf714d39e7a2
GitHub-Last-Rev: 351404b
GitHub-Pull-Request: golang#32
Reviewed-on: https://go-review.googlesource.com/c/text/+/422414
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Tim King <taking@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
@golang golang locked and limited conversation to collaborators Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants