cmd/compile/internal/gc: esc.go duplicated sink paths for re-assignments #27003
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Given this code:
(Code annotated with line number for convenience, minimal example outlined after the issue description.)
Execute the command
$ go tool compile -m=2 example.go
.The output on tip is (important bits are in bold):
Expected output would not report second sink to the same location.
This is a consequence of how graph is constructed and printed.
Simplified example:
And the output:
Expected output:
For that example, we have something like this:
sink
pseudo node has 2 source edges, both comes fromx
node.x
node has 2 source edges, they come from the two differentnew(int)
During traversal in
escwalkBody
, bothnew(int)
paths are printed using firstsink
destination as a parent, so we get two same paths. For the second destination nothing is printed due toosrcesc
variable check that is used to avoid duplicated messages.If
osrcesc
is removed, both paths are printed twice (so, 4 messages instead of 2, but 2 of them are correct). Currently,osrcesc
leads to 2 messages, 1 of which is incorrect.It's not enough to just check whether destination node located before the actual starting flow point because of recursive functions:
Here the
return y
is a destination endpoint, and it comes before the tracked&x
.I have no good ideas on how to fix this one.
Hopefully, insights above can help someone to roll the solution to this.
The text was updated successfully, but these errors were encountered: