aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2023-11-10 18:03:00 -0800
committerGopher Robot <gobot@golang.org>2023-11-21 20:34:12 +0000
commit00715d089d68c1dd43ed1f508e8937c5208fb6f0 (patch)
treedddcdb7b64fc1df98b458e4bb893615b725aa214 /test/codegen
parente5615ad876aee4974aa1eb2683d545d82e173a58 (diff)
downloadgo-00715d089d68c1dd43ed1f508e8937c5208fb6f0.tar.xz
cmd/compile/internal/walk: copy SSA-able variables
order.go ensures expressions that are passed to the runtime by address are in fact addressable. However, in the case of local variables, if the variable hasn't already been marked as addrtaken, then taking its address here will effectively prevent the variable from being converted to SSA form. Instead, it's better to just copy the variable into a new temporary, which we can pass by address instead. This ensures the original variable can still be converted to SSA form. Fixes #63332. Change-Id: I182376d98d419df8bf07c400d84c344c9b82c0fb Reviewed-on: https://go-review.googlesource.com/c/go/+/541715 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/issue63332.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/codegen/issue63332.go b/test/codegen/issue63332.go
new file mode 100644
index 0000000000..dbe671d247
--- /dev/null
+++ b/test/codegen/issue63332.go
@@ -0,0 +1,14 @@
+// asmcheck
+
+// Copyright 2023 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package codegen
+
+func issue63332(c chan int) {
+ x := 0
+ // amd64:-`MOVQ`
+ x += 2
+ c <- x
+}