| 1 |
// errorcheck -0 -live |
| 2 |
|
| 3 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Issue 42944: address of callee args area should only be short-lived |
| 8 |
// and never across a call. |
| 9 |
|
| 10 |
package p |
| 11 |
|
| 12 |
type T [10]int // trigger DUFFCOPY when passing by value, so it uses the address |
| 13 |
|
| 14 |
func F() { |
| 15 |
var x T |
| 16 |
var i int |
| 17 |
for { |
| 18 |
x = G(i) // no autotmp live at this and next calls |
| 19 |
H(i, x) |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
func G(int) T |
| 24 |
func H(int, T) |