Skip to content

x/tools/go/ssa: emitConv panic on generics #57272

Closed
@zpavlinovic

Description

@zpavlinovic

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

$ go version

go1.19.3

Does this issue reproduce with the latest release?

Yes, also reproduced with go version go1.20-pre3.

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

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="[redacted]/.cache/go-build"
GOENV="[redacted]/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="[redacted]/go/pkg/mod"
GONOPROXY=".git.corp.google.com"
GONOSUMDB="
.git.corp.google.com"
GOOS="linux"
GOPATH="[redacted]/go"
GOPRIVATE="*.git.corp.google.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="[redacted]"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="[redacted]/linux_amd64"
GOVCS=""
GOVERSION="go1.20-pre3 cl/474093167 +a813be86df"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="[redacted]/minio/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 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2425109656=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Run ssa on https://github.com/minio/minio. Reproducible by running govulncheck, which uses ssa:

govulncheck ./...

Also reproducible if govulncheck uses (the latest) v0.4.1-0.20221212161611-18f76ecd3f38 version of tools.

What did you expect to see?

No panic.

What did you see instead?

panic: in github.com/minio/minio/internal/config.Error: cannot convert *t0 (PT) to T

goroutine 16266 [running]:
golang.org/x/tools/go/ssa.emitConv(0xc06b569680, {0x9436a0, 0xc080fa2ea0}, {0x93fcb8?, 0xc052874180})
       [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/emit.go:295 +0xa2c
golang.org/x/tools/go/ssa.(*builder).stmt(0xc080f9acc0?, 0xc06b569680, {0x941208?, 0xc04c2a2fc0?})
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2220 +0x1145
golang.org/x/tools/go/ssa.(*builder).stmtList(0x40d11d?, 0x849dc0?, {0xc03c94cac0?, 0x3, 0xc080fa41b0?})
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:946 +0x45
golang.org/x/tools/go/ssa.(*builder).stmt(0xc06b569680?, 0xc06b569680, {0x940c68?, 0xc04cb0cd80?})
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2277 +0x859
golang.org/x/tools/go/ssa.(*builder).buildFunctionBody(0x656791?, 0xc06b569680)
       [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2391 +0x437
golang.org/x/tools/go/ssa.(*builder).buildFunction(0x6567e0?, 0xc06b569680)
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2326 +0x2e
golang.org/x/tools/go/ssa.(*builder).buildCreated(0xc076503e18)
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2413 +0x25
golang.org/x/tools/go/ssa.(*Package).build(0xc06b508980)
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2606 +0xc86
sync.(*Once).doSlow(0xc00260cfb8?, 0x608ede?)
        [redacted]/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        [redacted]/src/sync/once.go:65
golang.org/x/tools/go/ssa.(*Package).Build(...)
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2477
golang.org/x/tools/go/ssa.(*Program).Build.func1(0x0?)
       [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2462 +0x4c
created by golang.org/x/tools/go/ssa.(*Program).Build
        [redacted]/go/pkg/mod/golang.org/x/[email protected]/go/ssa/builder.go:2461 +0x19c

It looks like this is the function causing the panic. Perhaps a duplicate of #56849?

Thanks to @harshavardhana for reporting this.

cc @timothy-king

Metadata

Metadata

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.vulncheck or vulndbIssues for the x/vuln or x/vulndb repo

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions