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: panic recovered: unexpected CompositeLit type: invalid type #58448

Open
prattmic opened this issue Feb 9, 2023 · 2 comments
Open
Assignees
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@prattmic
Copy link
Member

prattmic commented Feb 9, 2023

buildssa seems to choke on cmd/go/internal/modload/build.go:

checkescape: external/go_sdk/src/cmd/go/internal/modload/build.go: panic recovered: unexpected CompositeLit type: invalid type (goroutine 23200 [running]:
runtime/debug.Stack()
        GOROOT/src/runtime/debug/stack.go:24 +0x65
gvisor.dev/gvisor/tools/nogo/check.(*importer).checkPackage.func2.9()
        tools/nogo/check/check.go:554 +0xa5
panic({0x92eec0, 0xc001a2d870})
        GOROOT/src/runtime/panic.go:890 +0x262
golang.org/x/tools/go/ssa.(*builder).compLit(0xc001202030?, 0xdc8d80?, {0xacc400, 0xc004a4b980}, 0xc00194c1c0, 0x1, 0xc0002bcef0)
        external/org_golang_x_tools/go/ssa/builder.go:1364 +0xcc5
golang.org/x/tools/go/ssa.(*builder).assign(0xc003f64b60?, 0xc003f64b60?, {0xacb998?, 0xc001202030}, {0xacab28?, 0xc00194c1c0?}, 0xa0?, 0xc0002bcef0)
        external/org_golang_x_tools/go/ssa/builder.go:573 +0x3d1
golang.org/x/tools/go/ssa.(*builder).assignStmt(0xc0035ea800?, 0xc003f64b60, {0xc0035006b0, 0x1, 0x6cb5e5?}, {0xc0035006d0, 0x1, 0xc0011f9fb0?}, 0x1)
        external/org_golang_x_tools/go/ssa/builder.go:1182 +0x265
golang.org/x/tools/go/ssa.(*builder).stmt(0xc004a4b260?, 0xc003f64b60, {0xaca8e8?, 0xc00194c240?})
        external/org_golang_x_tools/go/ssa/builder.go:2134 +0xf65
golang.org/x/tools/go/ssa.(*builder).stmtList(0x410342?, 0xc003f64b60?, {0xc004eb76e0?, 0x2, 0x8?})
        external/org_golang_x_tools/go/ssa/builder.go:923 +0x67
golang.org/x/tools/go/ssa.(*builder).stmt(0x9ae2a0?, 0xc003f64b60, {0xacaa08?, 0xc002939c20?})
        external/org_golang_x_tools/go/ssa/builder.go:2230 +0xefd
golang.org/x/tools/go/ssa.(*builder).stmt(0x44e414?, 0xc003f64b60, {0xacad98?, 0xc00194c340?})
        external/org_golang_x_tools/go/ssa/builder.go:2244 +0x6d9
golang.org/x/tools/go/ssa.(*builder).stmtList(0x7f2ad413c601?, 0xc0011f9ef0?, {0xc0022c2300?, 0x8, 0xc00007b400?})
        external/org_golang_x_tools/go/ssa/builder.go:923 +0x67
golang.org/x/tools/go/ssa.(*builder).stmt(0xc003f64b60?, 0xc003f64b60, {0xacaa08?, 0xc002939e90?})
        external/org_golang_x_tools/go/ssa/builder.go:2230 +0xefd
golang.org/x/tools/go/ssa.(*builder).buildFunctionBody(0x6cac91?, 0xc003f64b60)
        external/org_golang_x_tools/go/ssa/builder.go:2339 +0x489
golang.org/x/tools/go/ssa.(*builder).buildFunction(0x6cace0?, 0xc003f64b60)
        external/org_golang_x_tools/go/ssa/builder.go:2279 +0x2e
golang.org/x/tools/go/ssa.(*builder).buildCreated(0xc0002bd9d0)
        external/org_golang_x_tools/go/ssa/builder.go:2361 +0x25
golang.org/x/tools/go/ssa.(*Package).build(0xc0045c3b80)
        external/org_golang_x_tools/go/ssa/builder.go:2544 +0xcc5
sync.(*Once).doSlow(0xc0046369c0?, 0xc000a3f040?)
        GOROOT/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
        GOROOT/src/sync/once.go:65
golang.org/x/tools/go/ssa.(*Package).Build(...)
        external/org_golang_x_tools/go/ssa/builder.go:2425
golang.org/x/tools/go/analysis/passes/buildssa.run(0xc00298a000)
        external/org_golang_x_tools/go/analysis/passes/buildssa/buildssa.go:73 +0x1a8
gvisor.dev/gvisor/tools/nogo/check.(*importer).checkPackage.func2(0xdced40, 0x0?)
        tools/nogo/check/check.go:579 +0xc78
created by gvisor.dev/gvisor/tools/nogo/check.(*importer).checkPackage
        tools/nogo/check/check.go:403 +0x965
)

This is running through https://github.com/google/gvisor/tree/master/tools/nogo. FWIW, I wasn't able to trivially reproduce this with a buildssa singlechecker, so there might be some aspect of the importer at play.

To reproduce:

$ git clone https://github.com/google/gvisor
$ git checkout 89cc675c292b4c06d6b3651671478c8d272490f9 # just for consistency with what I tested
$ vim nogo.yaml
# Comment out the `- "panic recovered: unexpected CompositeLit type: invalid type"` line (which suppresses the error).
$ bazel test //pkg/sync:sync_nogo --//tools/nogo:full=true

cc @timothy-king @zpavlinovic @adonovan @amscanne

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Feb 9, 2023
@gopherbot gopherbot added this to the Unreleased milestone Feb 9, 2023
@adonovan
Copy link
Member

adonovan commented Apr 2, 2024

Dup of #65608.

@adonovan adonovan closed this as completed Apr 2, 2024
@timothy-king
Copy link
Contributor

Reopening. I don't think this is a dup of #65608. The panic is in compLit.

@timothy-king timothy-king reopened this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants