]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix package initialization ordering
authorMatthew Dempsky <mdempsky@google.com>
Thu, 28 Mar 2019 21:35:49 +0000 (14:35 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 29 May 2019 20:29:04 +0000 (20:29 +0000)
commit5d0d87ae1659807909da9d97ed1da77d7544d30c
treeb11214f076cd484f862c69f3a82fab90cf26df2d
parente883d000f4ce0c47711c3a7c59df8bb2f0ec557f
cmd/compile: fix package initialization ordering

This CL rewrites cmd/compile's package-level initialization ordering
algorithm to be compliant with the Go spec. See documentation in
initorder.go for details.

Incidentally, this CL also improves fidelity of initialization loop
diagnostics by including referenced functions in the emitted output
like go/types does.

Fixes #22326.

Change-Id: I7c9ac47ff563df4d4f700cf6195387a0f372cc7b
Reviewed-on: https://go-review.googlesource.com/c/go/+/170062
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/init.go
src/cmd/compile/internal/gc/initorder.go [new file with mode: 0644]
src/cmd/compile/internal/gc/sinit.go
src/cmd/compile/internal/gc/syntax.go
test/fixedbugs/issue22326.go [new file with mode: 0644]
test/fixedbugs/issue22326.out [new file with mode: 0644]