aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2026-01-21 14:39:20 +0700
committerGopher Robot <gobot@golang.org>2026-01-22 07:30:19 -0800
commitdae71067ce7ee41ebe752a4ee3c544506e74f824 (patch)
tree400e212dc7aba8e8527b967aa751eb0af2cfd4ee /test/codegen
parentadb64adfd74470a0653dde9214a1acb0ddf72268 (diff)
downloadgo-dae71067ce7ee41ebe752a4ee3c544506e74f824.tar.xz
cmd/compile: fix mis-compilation for static array initialization
The bug was first introduced when the compiler is still written in C, with CL 2254041. The static array was laid out with the wrong context, causing a stack pointer will be stored in global object. Fixes #61730 Fixes #77193 Change-Id: I22c8393314d251beb53db537043a63714c84f36a Reviewed-on: https://go-review.googlesource.com/c/go/+/737821 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/slices.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/codegen/slices.go b/test/codegen/slices.go
index 1c48b38047..32561b2235 100644
--- a/test/codegen/slices.go
+++ b/test/codegen/slices.go
@@ -456,3 +456,15 @@ func SlicePut(a []byte, c uint8) []byte {
a = a[1:]
return a
}
+
+func Issue61730() {
+ var x int
+ // amd64:-"MOVQ .*stmp_"
+ _ = [...][]*int{
+ {&x},
+ nil,
+ nil,
+ nil,
+ nil,
+ }
+}