]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: rewrite a, b = f() to use temporaries when type not identical
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Sun, 13 Jun 2021 15:28:44 +0000 (22:28 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 14 Jun 2021 07:12:37 +0000 (07:12 +0000)
commit326ea438bb579a2010e38e00f515a04344ff96b0
treeda29b2c3285e8299cc3936b2ec5691edea006bcf
parent3249b645c986849bbf72c1dc71efc4f90df465ec
cmd/compile: rewrite a, b = f() to use temporaries when type not identical

If any of the LHS expressions of an OAS2FUNC are not identical to the
respective function call results, escape analysis mishandles the
implicit conversion, causes memory corruption.

Instead, we should insert autotmps like we already do for f(g()) calls
and return g() statements.

Fixes #46725

Change-Id: I71a08da0bf1a03d09a023da5b6f78fb37a4a4690
Reviewed-on: https://go-review.googlesource.com/c/go/+/327651
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/typecheck/stmt.go
src/cmd/compile/internal/typecheck/typecheck.go
test/declbad.go
test/fixedbugs/issue46725.go [new file with mode: 0644]