Skip to content

Commit b22af9b

Browse files
committed
cmd/link: record only the first occurance in Reachparent graph
In the deadcode pass, a type symbol may be marked twice, one without UsedInIface, one with. For the second time, don't update the Reachparent graph, so it only records the path of the first time the symbol is reached. This ensures the Reachparent graph is acyclic. TODO: add a test. (This only affects GOEXPERIMENT=fieldtrack) Change-Id: I68e8a1a69c3830bc8aee5df946151dc22dcb2b29 Reviewed-on: https://go-review.googlesource.com/c/go/+/254297 Run-TryBot: Cherry Zhang <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent 03a6860 commit b22af9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmd/link/internal/ld/deadcode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (d *deadcodePass) mark(symIdx, parent loader.Sym) {
209209
if symIdx != 0 && !d.ldr.AttrReachable(symIdx) {
210210
d.wq.push(symIdx)
211211
d.ldr.SetAttrReachable(symIdx, true)
212-
if objabi.Fieldtrack_enabled != 0 {
212+
if objabi.Fieldtrack_enabled != 0 && d.ldr.Reachparent[symIdx] == 0 {
213213
d.ldr.Reachparent[symIdx] = parent
214214
}
215215
if *flagDumpDep {

0 commit comments

Comments
 (0)