| // Copyright 2016 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. |
| // issue 16515: spilled Duff-adjusted address may be invalid |
| type T [62]int // DUFFZERO with non-zero adjustment on AMD64 |
| // Two DUFFZEROs on the same address with a function call in between. |
| // Duff-adjusted address will be spilled and loaded |
| g() // call a function with large frame, trigger a stack move |
| *x = T{} // DUFFZERO again |
| // a function with large frame |
| var s struct { a T; b [8192-62]int } // allocate 64K, hopefully it's in a new span and a few bytes before it is garbage |
| sink = &s // force heap allocation |
| println("s.a[0] =", s.a[0]) |