Skip to content

panic: T for Rta algo #161

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

Closed
Gaojianli opened this issue May 23, 2023 · 2 comments
Closed

panic: T for Rta algo #161

Gaojianli opened this issue May 23, 2023 · 2 comments
Labels
Milestone

Comments

@Gaojianli
Copy link

Hello, i am using go-callvis with the rta algorithm. However i got a panic with it:

$ go-callvis  -algo rta .
panic: T

goroutine 1 [running]:
golang.org/x/tools/go/callgraph/rta.(*rta).addRuntimeType(0x1429b671b58, {0x105580d88?, 0x1404e342e10?}, 0x0)
        golang.org/x/[email protected]/go/callgraph/rta/rta.go:457 +0x7a0
golang.org/x/tools/go/callgraph/rta.(*rta).addRuntimeType(0x1429b671b58, {0x105580ce8?, 0x1404e36dfa0?}, 0x1)
        golang.org/x/[email protected]/go/callgraph/rta/rta.go:416 +0x568
golang.org/x/tools/go/callgraph/rta.(*rta).addRuntimeType(0x1429b671b58, {0x105580c70?, 0x1404e176690?}, 0x0)
        golang.org/x/[email protected]/go/callgraph/rta/rta.go:441 +0x6a4
golang.org/x/tools/go/callgraph/rta.(*rta).visitFunc(0x0?, 0x141a0323200)
        golang.org/x/[email protected]/go/callgraph/rta/rta.go:248 +0x14c
golang.org/x/tools/go/callgraph/rta.Analyze({0x1428d8bfad8, 0x1, 0x10538ce8a?}, 0x1)
        golang.org/x/[email protected]/go/callgraph/rta/rta.go:300 +0x3d0
main.(*analysis).DoAnalysis(0x14000020b40, {0x16b003749, 0x3}, {0x0?, 0x14000056708?}, 0xe8?, {0x140000200b0?, 0x300000002?, 0x140000b9f28?})
        github.com/ofabry/go-callvis/analysis.go:118 +0x710
main.main()
        github.com/ofabry/go-callvis/main.go:145 +0x294

it seems that the panic occurs on following code:

type Iter[T any] interface {
	// Next returns next N items of iterator when it is not empty.
	// When iterator is empty, nil is returned.
	// When n = [ALL] or n is greater than number of remaining elements,
	// all remaining are returned.
	//
	// The returned slice is owned by caller. So implementer should return a
	// newly allocated slice if needed.
	//
	// Passing in a negative n (except [ALL]) is undefined behavior.
	Next(n int) []T
}

Does the RTA algorithm not support generics?

@cnzhujie
Copy link
Contributor

golang/go#60137

The issue is due to I didn't used the mode ssa.InstantiateGenerics when building ssa packages.

cnzhujie added a commit to cnzhujie/go-callvis that referenced this issue Nov 15, 2024
cnzhujie added a commit to cnzhujie/go-callvis that referenced this issue Nov 15, 2024
ondrajz pushed a commit that referenced this issue Dec 30, 2024
@ondrajz
Copy link
Owner

ondrajz commented Dec 30, 2024

Fixed in 7306502

@ondrajz ondrajz closed this as completed Dec 30, 2024
@ondrajz ondrajz added the bug label Dec 30, 2024
@ondrajz ondrajz added this to the v0.8.0 milestone Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants