]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: un-hide closure func if parent expr moved to staticinit
authorThan McIntosh <thanm@google.com>
Wed, 3 May 2023 16:38:50 +0000 (12:38 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 5 May 2023 21:04:38 +0000 (21:04 +0000)
commit89138ce740bf72c7a6c0eae5aa281f10094637cf
tree92afdaa6f9cf51e82ee93e258b6ab237790f3176
parentea69de9b921a1c1abbfe82012194c8e946e14cfd
cmd/compile: un-hide closure func if parent expr moved to staticinit

If the function referenced by a closure expression is incorporated
into a static init, be sure to mark it as non-hidden, since otherwise
it will be live but no longer reachable from the init func, hence it
will be skipped during escape analysis, which can lead to
miscompilations.

Fixes #59680.

Change-Id: Ib858aee296efcc0b7655d25c23ab8a6a8dbdc5f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/492135
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/staticinit/sched.go
test/fixedbugs/issue59680.go [new file with mode: 0644]