]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: special case coverage vars in pkg init order
authorThan McIntosh <thanm@google.com>
Tue, 18 Oct 2022 15:28:52 +0000 (11:28 -0400)
committerThan McIntosh <thanm@google.com>
Tue, 18 Oct 2022 18:14:15 +0000 (18:14 +0000)
commit4fb35d6cee036fa2583512940de91a03f7f029e9
tree82d0353c903e24e7a46806577911e5a80af52a14
parent7ae652b7c0cddb8f6e04bfa6f5805baac823dd64
cmd/compile: special case coverage vars in pkg init order

When computing package initialization order, special case the counter
variables inserted by "cmd/cover" for coverage instrumentation, since
their presence can perturb the order in which variables are
initialized in ways that are user-visible and incorrect with respect
to the original (uninstrumented) program.

Fixes #56293.

Change-Id: Ieec9239ded4f8e2503ff9bbe0fe171afb771b335
Reviewed-on: https://go-review.googlesource.com/c/go/+/443715
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/coverage/cover.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/pkginit/initorder.go
src/cmd/go/testdata/script/cover_var_init_order.txt [new file with mode: 0644]