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 in (*FieldAddr).String #59983

Closed
timothy-king opened this issue May 4, 2023 · 1 comment
Closed

x/tools/go/ssa: panic in (*FieldAddr).String #59983

timothy-king opened this issue May 4, 2023 · 1 comment
Assignees
Labels
Analysis Issues related to static analysis (vet, x/tools/go/analysis) FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@timothy-king
Copy link
Contributor

Writing the function g.c from ssa/builder_generic_test.go (included below) panics with the stack trace:

panic: interface conversion: types.Type is *types.Pointer, not *types.Struct [recovered]
	panic: interface conversion: types.Type is *types.Pointer, not *types.Struct

goroutine 36 [running]:
testing.tRunner.func1.2({0x130bc20, 0xc000326ab0})
	/Users/taking/sdk/gotip/src/testing/testing.go:1545 +0x238
testing.tRunner.func1()
	/Users/taking/sdk/gotip/src/testing/testing.go:1548 +0x39f
panic({0x130bc20?, 0xc000326ab0?})
	/Users/taking/sdk/gotip/src/runtime/panic.go:913 +0x21f
golang.org/x/tools/go/ssa.(*FieldAddr).String(0xc000317860)
	/Users/taking/gorepos/tools/go/ssa/print.go:262 +0x149
golang.org/x/tools/go/ssa.WriteFunction(0xc000103a60?, 0xc0002e1800)
	/Users/taking/gorepos/tools/go/ssa/func.go:645 +0xc04
golang.org/x/tools/go/ssa.(*Function).WriteTo(0xc000103e10?, {0x13d8ca0, 0xc0000a4010})
	/Users/taking/gorepos/tools/go/ssa/func.go:570 +0x3c
golang.org/x/tools/go/ssa_test.TestGenericBodies.func1(0xc000205d40)
	/Users/taking/gorepos/tools/go/ssa/builder_generic_test.go:495 +0x62a
testing.tRunner(0xc000205d40, 0xc00031b7d0)

The package g is:

package g
type S struct{ f int }
func c[P *S]() []P { return []P{{f: 1}} }
@timothy-king timothy-king added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Analysis Issues related to static analysis (vet, x/tools/go/analysis) labels May 4, 2023
@timothy-king timothy-king self-assigned this May 4, 2023
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label May 4, 2023
@gopherbot gopherbot added this to the Unreleased milestone May 4, 2023
@timothy-king
Copy link
Contributor Author

Fixed in https://go.dev/cl/494978.

@golang golang locked and limited conversation to collaborators Jun 5, 2024
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 NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants