x/tools/go/ssa: no way to determine type of *deferStack
#72914
Labels
Analysis
Issues related to static analysis (vet, x/tools/go/analysis)
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
Go version
go version go1.24.0 linux/arm64
Output of
go env
in your module/workspace:What did you do?
I have the following code:
I ran it through
ssadump
:What did you see happen?
See this short part of the output of the main function:
It has a
new *deferStack (defer$stack)
instruction. Unfortunately, it's hard to detect this specific type. For other types (in the go/types package) you can use type asserts and such to determine the type, but there is no way to do it for the deferStack.(Also,
typeutil.Map
panics when it encounters a*deferStack
type sotypeutil.Map
can't be used here, I'm not sure whether this is intended or not).What did you expect to see?
I would like to see a way to detect this type, either by making the
ssa.opaqueType
public (to allow type asserts) or by makingssa.tDeferStack
public (to compare against).I guess I can use reflection to do the same, but that feels like a kludge and not how the API was meant to be used.
The text was updated successfully, but these errors were encountered: