| // Copyright 2015 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. |
| // Tests escape analysis for range of arrays. |
| // Compiles but need not run. Inlining is disabled. |
| func g(a *A) int { // ERROR "a does not escape" |
| func h(a *B) *uint64 { // ERROR "leaking param: a to result ~r1 level=1" |
| func h2(a *B) *uint64 { // ERROR "leaking param: a to result ~r1 level=1" |
| // Seems like below should be level=1, not 0. |
| func k(a B) *uint64 { // ERROR "leaking param: a to result ~r1 level=0" |
| var x1, x2, x3, x4 uint64 // ERROR "moved to heap: x1" "moved to heap: x3" |
| println("*sink=", *sink) // Verify that sink addresses x1 |
| println("*sink=", *sink) // Verify that sink addresses x3 |