]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix wrong escape analysis for go/defer generic calls
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Tue, 7 Feb 2023 12:28:15 +0000 (19:28 +0700)
committerGopher Robot <gobot@golang.org>
Mon, 13 Feb 2023 21:28:54 +0000 (21:28 +0000)
commit93f10b88293f331d507cf62f4374ec809f611780
tree4b4c7beba12e059376b7a916b7e89fbd2713b41f
parent1e9925f461c54f5fdc100f9f23916b3df81262ce
cmd/compile: fix wrong escape analysis for go/defer generic calls

For go/defer calls like "defer f(x, y)", the compiler rewrites it to:

x1, y1 := x, y
defer func() { f(x1, y1) }()

However, if "f" needs runtime type information, the "RType" field will
refer to the outer ".dict" param, causing wrong liveness analysis.

To fix this, if "f" refers to outer ".dict", the dict param will be
copied to an autotmp, and "f" will refer to this autotmp instead.

Fixes #58341

Change-Id: I238b6e75441442b5540d39bc818205398e80c94d
Reviewed-on: https://go-review.googlesource.com/c/go/+/466035
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/escape/call.go
test/fixedbugs/issue58341.go [new file with mode: 0644]