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>
// lay out static data
vstat := readonlystaticname(t)
- ctxt := inInitFunction
- if n.Op() == ir.OARRAYLIT {
- ctxt = inNonInitFunction
- }
- fixedlit(ctxt, initKindStatic, n, vstat, init)
+ fixedlit(inInitFunction, initKindStatic, n, vstat, init)
// copy static to var
appendWalkStmt(init, ir.NewAssignStmt(base.Pos, var_, vstat))
a = a[1:]
return a
}
+
+func Issue61730() {
+ var x int
+ // amd64:-"MOVQ .*stmp_"
+ _ = [...][]*int{
+ {&x},
+ nil,
+ nil,
+ nil,
+ nil,
+ }
+}