3 // Copyright 2010 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.
7 // Test, using compiler diagnostic flags, that the escape analysis is working.
8 // Compiles but does not run. Inlining is disabled.
19 func foo1(x int) { // ERROR "moved to heap: x"
20 gxx = &x // ERROR "&x escapes to heap"
23 func foo2(yy *int) { // ERROR "leaking param: yy"
27 func foo3(x int) *int { // ERROR "moved to heap: x"
28 return &x // ERROR "&x escapes to heap"
33 func foo3b(t T) { // ERROR "leaking param: t"
37 // xx isn't going anywhere, so use of yy is ok
38 func foo4(xx, yy *int) { // ERROR "xx does not escape" "yy does not escape"
42 // xx isn't going anywhere, so taking address of yy is ok
43 func foo5(xx **int, yy *int) { // ERROR "xx does not escape" "yy does not escape"
44 xx = &yy // ERROR "&yy does not escape"
47 func foo6(xx **int, yy *int) { // ERROR "xx does not escape" "leaking param: yy"
51 func foo7(xx **int, yy *int) { // ERROR "xx does not escape" "yy does not escape"
55 func foo8(xx, yy *int) int { // ERROR "xx does not escape" "yy does not escape"
60 func foo9(xx, yy *int) *int { // ERROR "leaking param: xx" "leaking param: yy"
65 func foo10(xx, yy *int) { // ERROR "xx does not escape" "yy does not escape"
71 xx := &x // ERROR "&x does not escape"
72 yy := &y // ERROR "&y does not escape"
79 func foo12(yyy **int) { // ERROR "leaking param: yyy"
83 // Must treat yyy as leaking because *yyy leaks, and the escape analysis
84 // summaries in exported metadata do not distinguish these two cases.
85 func foo13(yyy **int) { // ERROR "leaking param: yyy"
89 func foo14(yyy **int) { // ERROR "yyy does not escape"
93 func foo15(yy *int) { // ERROR "moved to heap: yy"
94 xxx = &yy // ERROR "&yy escapes to heap"
97 func foo16(yy *int) { // ERROR "leaking param: yy"
101 func foo17(yy *int) { // ERROR "yy does not escape"
105 func foo18(y int) { // ERROR "moved to heap: "y"
106 *xxx = &y // ERROR "&y escapes to heap"
119 return &Bar{42, nil} // ERROR "&Bar literal escapes to heap"
122 func NewBarp(x *int) *Bar { // ERROR "leaking param: x"
123 return &Bar{42, x} // ERROR "&Bar literal escapes to heap"
126 func NewBarp2(x *int) *Bar { // ERROR "x does not escape"
127 return &Bar{*x, nil} // ERROR "&Bar literal escapes to heap"
130 func (b *Bar) NoLeak() int { // ERROR "b does not escape"
134 func (b *Bar) Leak() *int { // ERROR "leaking param: b"
135 return &b.i // ERROR "&b.i escapes to heap"
138 func (b *Bar) AlsoNoLeak() *int { // ERROR "leaking param b content to result ~r0"
142 func (b Bar) AlsoLeak() *int { // ERROR "leaking param: b"
146 func (b Bar) LeaksToo() *int { // ERROR "leaking param: b"
147 v := 0 // ERROR "moved to heap: v"
148 b.ii = &v // ERROR "&v escapes"
152 func (b *Bar) LeaksABit() *int { // ERROR "leaking param b content to result ~r0"
153 v := 0 // ERROR "moved to heap: v"
154 b.ii = &v // ERROR "&v escapes"
158 func (b Bar) StillNoLeak() int { // ERROR "b does not escape"
160 b.ii = &v // ERROR "&v does not escape"
164 func goLeak(b *Bar) { // ERROR "leaking param: b"
173 func NewBar2() *Bar2 {
174 return &Bar2{[12]int{42}, nil} // ERROR "&Bar2 literal escapes to heap"
177 func (b *Bar2) NoLeak() int { // ERROR "b does not escape"
181 func (b *Bar2) Leak() []int { // ERROR "leaking param: b"
182 return b.i[:] // ERROR "b.i escapes to heap"
185 func (b *Bar2) AlsoNoLeak() []int { // ERROR "leaking param b content to result ~r0"
189 func (b Bar2) AgainNoLeak() [12]int { // ERROR "b does not escape"
193 func (b *Bar2) LeakSelf() { // ERROR "leaking param: b"
194 b.ii = b.i[0:4] // ERROR "b.i escapes to heap"
197 func (b *Bar2) LeakSelf2() { // ERROR "leaking param: b"
199 buf = b.i[0:] // ERROR "b.i escapes to heap"
203 func foo21() func() int {
204 x := 42 // ERROR "moved to heap: x"
205 return func() int { // ERROR "func literal escapes to heap"
206 return x // ERROR "&x escapes to heap"
212 return func() int { // ERROR "func literal does not escape"
217 func foo23(x int) func() int { // ERROR "moved to heap: x"
218 return func() int { // ERROR "func literal escapes to heap"
219 return x // ERROR "&x escapes to heap"
223 func foo23a(x int) func() int { // ERROR "moved to heap: x"
224 f := func() int { // ERROR "func literal escapes to heap"
225 return x // ERROR "&x escapes to heap"
230 func foo23b(x int) *(func() int) { // ERROR "moved to heap: x"
231 f := func() int { return x } // ERROR "moved to heap: f" "func literal escapes to heap" "&x escapes to heap"
232 return &f // ERROR "&f escapes to heap"
235 func foo24(x int) int {
236 return func() int { // ERROR "func literal does not escape"
243 func fooleak(xx *int) int { // ERROR "leaking param: xx"
248 func foonoleak(xx *int) int { // ERROR "xx does not escape"
252 func foo31(x int) int { // ERROR "moved to heap: x"
253 return fooleak(&x) // ERROR "&x escapes to heap"
256 func foo32(x int) int {
257 return foonoleak(&x) // ERROR "&x does not escape"
268 func (f *Foo) fooleak() { // ERROR "leaking param: f"
272 func (f *Foo) foonoleak() { // ERROR "f does not escape"
276 func (f *Foo) Leak() { // ERROR "leaking param: f"
280 func (f *Foo) NoLeak() { // ERROR "f does not escape"
284 func foo41(x int) { // ERROR "moved to heap: x"
285 F.xx = &x // ERROR "&x escapes to heap"
288 func (f *Foo) foo42(x int) { // ERROR "f does not escape" "moved to heap: x"
289 f.xx = &x // ERROR "&x escapes to heap"
292 func foo43(f *Foo, x int) { // ERROR "f does not escape" "moved to heap: x"
293 f.xx = &x // ERROR "&x escapes to heap"
296 func foo44(yy *int) { // ERROR "leaking param: yy"
300 func (f *Foo) foo45() { // ERROR "f does not escape"
304 // See foo13 above for explanation of why f leaks.
305 func (f *Foo) foo46() { // ERROR "leaking param: f"
309 func (f *Foo) foo47() { // ERROR "leaking param: f"
310 f.xx = &f.x // ERROR "&f.x escapes to heap"
315 func foo50(i *int) { // ERROR "leaking param: i"
319 var ptrMap map[*int]*int
321 func foo51(i *int) { // ERROR "leaking param: i"
325 func indaddr1(x int) *int { // ERROR "moved to heap: x"
326 return &x // ERROR "&x escapes to heap"
329 func indaddr2(x *int) *int { // ERROR "leaking param: x"
330 return *&x // ERROR "&x does not escape"
333 func indaddr3(x *int32) *int { // ERROR "leaking param: x"
334 return *(**int)(unsafe.Pointer(&x)) // ERROR "&x does not escape"
337 // From package math:
339 func Float32bits(f float32) uint32 {
340 return *(*uint32)(unsafe.Pointer(&f)) // ERROR "&f does not escape"
343 func Float32frombits(b uint32) float32 {
344 return *(*float32)(unsafe.Pointer(&b)) // ERROR "&b does not escape"
347 func Float64bits(f float64) uint64 {
348 return *(*uint64)(unsafe.Pointer(&f)) // ERROR "&f does not escape"
351 func Float64frombits(b uint64) float64 {
352 return *(*float64)(unsafe.Pointer(&b)) // ERROR "&b does not escape"
356 func float64bitsptr(f float64) *uint64 { // ERROR "moved to heap: f"
357 return (*uint64)(unsafe.Pointer(&f)) // ERROR "&f escapes to heap"
360 func float64ptrbitsptr(f *float64) *uint64 { // ERROR "leaking param: f"
361 return (*uint64)(unsafe.Pointer(f))
364 func typesw(i interface{}) *int { // ERROR "leaking param: i"
365 switch val := i.(type) {
369 v := int(*val) // ERROR "moved to heap: v"
370 return &v // ERROR "&v escapes to heap"
375 func exprsw(i *int) *int { // ERROR "leaking param: i"
376 switch j := i; *j + 110 {
386 // assigning to an array element is like assigning to the array
387 func foo60(i *int) *int { // ERROR "leaking param: i"
393 func foo60a(i *int) *int { // ERROR "i does not escape"
399 // assigning to a struct field is like assigning to the struct
400 func foo61(i *int) *int { // ERROR "leaking param: i"
409 func foo61a(i *int) *int { // ERROR "i does not escape"
418 // assigning to a struct field is like assigning to the struct but
419 // here this subtlety is lost, since s.a counts as an assignment to a
420 // track-losing dereference.
421 func foo62(i *int) *int { // ERROR "leaking param: i"
425 s := new(S) // ERROR "new[(]S[)] does not escape"
434 func foo63(m M) { // ERROR "m does not escape"
437 func foo64(m M) { // ERROR "leaking param: m"
441 func foo64b(m M) { // ERROR "leaking param: m"
451 foo63(&mv) // ERROR "&mv does not escape"
455 var mv MV // ERROR "moved to heap: mv"
456 foo64(&mv) // ERROR "&mv escapes to heap"
466 foo64(mv) // escapes but it's an int so irrelevant
469 func foo69(m M) { // ERROR "leaking param: m"
473 func foo70(mv1 *MV, m M) { // ERROR "leaking param: mv1" "leaking param: m"
478 func foo71(x *int) []*int { // ERROR "leaking param: x"
484 func foo71a(x int) []*int { // ERROR "moved to heap: x"
486 y = append(y, &x) // ERROR "&x escapes to heap"
493 y[0] = &x // ERROR "&x does not escape"
496 func foo72aa() [10]*int {
497 var x int // ERROR "moved to heap: x"
499 y[0] = &x // ERROR "&x escapes to heap"
505 for i := 0; i < 10; i++ {
507 x := i // ERROR "moved to heap: x"
508 y[i] = &x // ERROR "&x escapes to heap"
513 func foo72b() [10]*int {
515 for i := 0; i < 10; i++ {
516 x := i // ERROR "moved to heap: x"
517 y[i] = &x // ERROR "&x escapes to heap"
524 s := []int{3, 2, 1} // ERROR "\[\]int literal does not escape"
525 for _, v := range s {
526 vv := v // ERROR "moved to heap: vv"
527 // actually just escapes its scope
528 defer func() { // ERROR "func literal escapes to heap"
529 println(vv) // ERROR "&vv escapes to heap"
535 s := []int{3, 2, 1} // ERROR "\[\]int literal does not escape"
536 for _, v := range s {
537 vv := v // ERROR "moved to heap: vv"
538 // actually just escapes its scope
539 fn := func() { // ERROR "func literal escapes to heap"
540 println(vv) // ERROR "&vv escapes to heap"
549 s := []int{3, 2, 1} // ERROR "\[\]int literal does not escape"
550 for i, v := range s {
551 vv := v // ERROR "moved to heap: vv"
552 // actually just escapes its scope
553 array[i] = func() { // ERROR "func literal escapes to heap"
554 println(vv) // ERROR "&vv escapes to heap"
559 func myprint(y *int, x ...interface{}) *int { // ERROR "x does not escape" "leaking param: y"
563 func myprint1(y *int, x ...interface{}) *interface{} { // ERROR "y does not escape" "leaking param: x"
564 return &x[0] // ERROR "&x.0. escapes to heap"
567 func foo75(z *int) { // ERROR "z does not escape"
568 myprint(z, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
571 func foo75a(z *int) { // ERROR "z does not escape"
572 myprint1(z, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
575 func foo75esc(z *int) { // ERROR "leaking param: z"
576 gxx = myprint(z, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
579 func foo75aesc(z *int) { // ERROR "z does not escape"
580 var ppi **interface{} // assignments to pointer dereferences lose track
581 *ppi = myprint1(z, 1, 2, 3) // ERROR "[.][.][.] argument escapes to heap"
584 func foo76(z *int) { // ERROR "leaking param: z"
585 myprint(nil, z) // ERROR "[.][.][.] argument does not escape"
588 func foo76a(z *int) { // ERROR "leaking param: z"
589 myprint1(nil, z) // ERROR "[.][.][.] argument does not escape"
593 myprint(nil, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
597 myprint1(nil, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
601 defer myprint(nil, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
605 defer myprint1(nil, 1, 2, 3) // ERROR "[.][.][.] argument does not escape"
610 // TODO: This one really only escapes its scope, but we don't distinguish yet.
611 defer myprint(nil, 1, 2, 3) // ERROR "[.][.][.] argument escapes to heap"
617 defer myprint1(nil, 1, 2, 3) // ERROR "[.][.][.] argument escapes to heap"
621 func foo77(z []interface{}) { // ERROR "z does not escape"
622 myprint(nil, z...) // z does not escape
625 func foo77a(z []interface{}) { // ERROR "z does not escape"
629 func foo77b(z []interface{}) { // ERROR "leaking param: z"
630 var ppi **interface{}
631 *ppi = myprint1(nil, z...)
634 func foo78(z int) *int { // ERROR "moved to heap: z"
635 return &z // ERROR "&z escapes to heap"
638 func foo78a(z int) *int { // ERROR "moved to heap: z"
639 y := &z // ERROR "&z escapes to heap"
640 x := &y // ERROR "&y does not escape"
641 return *x // really return y
645 return new(int) // ERROR "new[(]int[)] escapes to heap"
651 // Really just escapes its scope but we don't distinguish
652 z = new(int) // ERROR "new[(]int[)] escapes to heap"
660 z := new(int) // ERROR "new[(]int[)] does not escape"
666 func tee(p *int) (x, y *int) { return p, p } // ERROR "leaking param"
668 func noop(x, y *int) {} // ERROR "does not escape"
671 var x, y, z int // ERROR "moved to heap"
672 go noop(tee(&z)) // ERROR "&z escapes to heap"
673 go noop(&x, &y) // ERROR "escapes to heap"
675 var u, v, w int // ERROR "moved to heap"
676 defer noop(tee(&u)) // ERROR "&u escapes to heap"
677 defer noop(&v, &w) // ERROR "escapes to heap"
681 type Fooer interface {
685 type LimitedFooer struct {
690 func LimitFooer(r Fooer, n int64) Fooer { // ERROR "leaking param: r"
691 return &LimitedFooer{r, n} // ERROR "&LimitedFooer literal escapes to heap"
694 func foo90(x *int) map[*int]*int { // ERROR "leaking param: x"
695 return map[*int]*int{nil: x} // ERROR "map\[\*int\]\*int literal escapes to heap"
698 func foo91(x *int) map[*int]*int { // ERROR "leaking param: x"
699 return map[*int]*int{x: nil} // ERROR "map\[\*int\]\*int literal escapes to heap"
702 func foo92(x *int) [2]*int { // ERROR "leaking param: x"
703 return [2]*int{x, nil}
707 func foo93(c chan *int) *int { // ERROR "c does not escape"
715 func foo94(m map[*int]*int, b bool) *int { // ERROR "m does not escape"
716 for k, v := range m {
726 func foo95(m map[*int]*int, x *int) { // ERROR "m does not escape" "leaking param: x"
731 func foo96(m []*int) *int { // ERROR "m does not escape"
736 func foo97(m [1]*int) *int { // ERROR "leaking param: m"
741 func foo98(m map[int]*int) *int { // ERROR "m does not escape"
746 func foo99(m *[1]*int) []*int { // ERROR "leaking param: m"
751 func foo100(m []*int) *int { // ERROR "m does not escape"
752 for _, v := range m {
759 func foo101(m [1]*int) *int { // ERROR "leaking param: m"
760 for _, v := range m {
767 func foo101a(m [1]*int) *int { // ERROR "m does not escape"
768 for i := range m { // ERROR "moved to heap: i"
769 return &i // ERROR "&i escapes to heap"
775 func foo102(m []*int, x *int) { // ERROR "m does not escape" "leaking param: x"
780 func foo103(m [1]*int, x *int) { // ERROR "m does not escape" "x does not escape"
787 func foo104(x []*int) { // ERROR "x does not escape"
792 func foo105(x []*int) { // ERROR "x does not escape"
797 func foo106(x *int) { // ERROR "leaking param: x"
801 func foo107(x *int) map[*int]*int { // ERROR "leaking param: x"
802 return map[*int]*int{x: nil} // ERROR "map.* literal escapes to heap"
805 func foo108(x *int) map[*int]*int { // ERROR "leaking param: x"
806 return map[*int]*int{nil: x} // ERROR "map.* literal escapes to heap"
809 func foo109(x *int) *int { // ERROR "leaking param: x"
810 m := map[*int]*int{x: nil} // ERROR "map.* literal does not escape"
811 for k, _ := range m {
817 func foo110(x *int) *int { // ERROR "leaking param: x"
818 m := map[*int]*int{nil: x} // ERROR "map.* literal does not escape"
822 func foo111(x *int) *int { // ERROR "leaking param: x"
823 m := []*int{x} // ERROR "\[\]\*int literal does not escape"
827 func foo112(x *int) *int { // ERROR "leaking param: x"
832 func foo113(x *int) *int { // ERROR "leaking param: x"
837 func foo114(x *int) *int { // ERROR "leaking param: x"
838 m := &Bar{ii: x} // ERROR "&Bar literal does not escape"
842 func foo115(x *int) *int { // ERROR "leaking param: x"
843 return (*int)(unsafe.Pointer(uintptr(unsafe.Pointer(x)) + 1))
846 func foo116(b bool) *int {
848 x := 1 // ERROR "moved to heap: x"
849 return &x // ERROR "&x escapes to heap"
851 y := 1 // ERROR "moved to heap: y"
852 return &y // ERROR "&y escapes to heap"
857 func foo117(unknown func(interface{})) { // ERROR "unknown does not escape"
858 x := 1 // ERROR "moved to heap: x"
859 unknown(&x) // ERROR "&x escapes to heap"
862 func foo118(unknown func(*int)) { // ERROR "unknown does not escape"
863 x := 1 // ERROR "moved to heap: x"
864 unknown(&x) // ERROR "&x escapes to heap"
869 func foo119(x *int) { // ERROR "leaking param: x"
874 // formerly exponential time analysis
975 // use the labels to silence compiler errors
1079 for i := 0; i < 10; i++ {
1080 defer myprint(nil, i) // ERROR "[.][.][.] argument escapes to heap"
1081 go myprint(nil, i) // ERROR "[.][.][.] argument escapes to heap"
1085 // same as foo121 but check across import
1087 for i := 0; i < 10; i++ {
1088 defer fmt.Printf("%d", i) // ERROR "[.][.][.] argument escapes to heap"
1089 go fmt.Printf("%d", i) // ERROR "[.][.][.] argument escapes to heap"
1093 // a harmless forward jump
1099 i = new(int) // ERROR "new.int. does not escape"
1103 // a backward jump, increases loopdepth
1108 i = new(int) // ERROR "new.int. escapes to heap"
1114 func foo124(x **int) { // ERROR "x does not escape"
1115 var i int // ERROR "moved to heap: i"
1116 p := &i // ERROR "&i escapes"
1117 func() { // ERROR "func literal does not escape"
1118 *x = p // ERROR "leaking closure reference p"
1122 func foo125(ch chan *int) { // ERROR "does not escape"
1123 var i int // ERROR "moved to heap"
1124 p := &i // ERROR "&i escapes to heap"
1125 func() { // ERROR "func literal does not escape"
1126 ch <- p // ERROR "leaking closure reference p"
1131 var px *int // loopdepth 0
1134 var i int // ERROR "moved to heap"
1135 func() { // ERROR "func literal does not escape"
1136 px = &i // ERROR "&i escapes"
1145 var i int // ERROR "moved to heap: i"
1146 p := &i // ERROR "&i escapes to heap"
1153 p := &i // ERROR "&i does not escape"
1159 var i int // ERROR "moved to heap: i"
1160 p := &i // ERROR "&i escapes to heap"
1161 func() { // ERROR "func literal does not escape"
1162 q := p // ERROR "leaking closure reference p"
1163 func() { // ERROR "func literal does not escape"
1164 r := q // ERROR "leaking closure reference q"
1172 var i int // ERROR "moved to heap"
1173 func() { // ERROR "func literal does not escape"
1174 px = &i // ERROR "&i escapes" "leaking closure reference i"
1180 var i int // ERROR "moved to heap"
1181 func() { // ERROR "func literal does not escape"
1182 px = &i // ERROR "&i escapes" "leaking closure reference i"
1187 var i int // ERROR "moved to heap"
1188 go func() { // ERROR "func literal escapes to heap"
1189 px = &i // ERROR "&i escapes" "leaking closure reference i"
1194 var i int // ERROR "moved to heap"
1195 defer func() { // ERROR "func literal does not escape"
1196 px = &i // ERROR "&i escapes" "leaking closure reference i"
1202 p := &i // ERROR "&i does not escape"
1203 func() { // ERROR "func literal does not escape"
1205 func() { // ERROR "func literal does not escape"
1213 var i int // ERROR "moved to heap: i"
1214 p := &i // ERROR "&i escapes to heap" "moved to heap: p"
1215 go func() { // ERROR "func literal escapes to heap"
1216 q := p // ERROR "&p escapes to heap"
1217 func() { // ERROR "func literal does not escape"
1225 var i int // ERROR "moved to heap: i"
1226 p := &i // ERROR "&i escapes to heap" "moved to heap: p"
1227 go func() { // ERROR "func literal escapes to heap"
1228 q := p // ERROR "&p escapes to heap" "leaking closure reference p"
1229 func() { // ERROR "func literal does not escape"
1230 r := q // ERROR "leaking closure reference q"
1237 var i int // ERROR "moved to heap: i"
1238 p := &i // ERROR "&i escapes to heap"
1239 func() { // ERROR "func literal does not escape"
1240 q := p // ERROR "leaking closure reference p" "moved to heap: q"
1241 go func() { // ERROR "func literal escapes to heap"
1242 r := q // ERROR "&q escapes to heap"
1248 func foo138() *byte {
1252 t := new(T) // ERROR "new.T. escapes to heap"
1253 return &t.x[0] // ERROR "&t.x.0. escapes to heap"
1256 func foo139() *byte {
1262 t := new(T) // ERROR "new.T. escapes to heap"
1263 return &t.x.y // ERROR "&t.x.y escapes to heap"
1267 func foo140() interface{} {
1275 t := &T{} // ERROR "&T literal escapes to heap"
1290 func F3(x []byte) // ERROR "F3 x does not escape"
1296 F1(buf1[:]) // ERROR "buf1 does not escape"
1298 var buf2 [10]byte // ERROR "moved to heap: buf2"
1299 F2(buf2[:]) // ERROR "buf2 escapes to heap"
1302 F3(buf3[:]) // ERROR "buf3 does not escape"
1304 var buf4 [10]byte // ERROR "moved to heap: buf4"
1305 F4(buf4[:]) // ERROR "buf4 escapes to heap"
1312 func (t *Tm) M() { // ERROR "t does not escape"
1318 t := new(Tm) // ERROR "escapes to heap"
1319 f = t.M // ERROR "t.M does not escape"
1326 t := new(Tm) // ERROR "escapes to heap"
1327 gf = t.M // ERROR "t.M escapes to heap"
1332 for i := 0; i < 1000; i++ {
1333 func() { // ERROR "func literal does not escape"
1334 for i := 0; i < 1; i++ {
1336 t.M() // ERROR "t does not escape"
1343 // Check that annotations take effect regardless of whether they
1344 // are before or after the use in the source code.
1352 foo144a(&x) // ERROR "&x does not escape"
1354 foo144b(&y) // ERROR "&y does not escape"
1361 // issue 7313: for loop init should not be treated as "in loop"
1367 func foo145(l List) { // ERROR "l does not escape"
1369 for p = &l; p.Next != nil; p = p.Next { // ERROR "&l does not escape"
1373 func foo146(l List) { // ERROR "l does not escape"
1375 p = &l // ERROR "&l does not escape"
1376 for ; p.Next != nil; p = p.Next {
1380 func foo147(l List) { // ERROR "l does not escape"
1382 p = &l // ERROR "&l does not escape"
1388 func foo148(l List) { // ERROR " l does not escape"
1389 for p := &l; p.Next != nil; p = p.Next { // ERROR "&l does not escape"
1393 // related: address of variable should have depth of variable, not of loop
1395 func foo149(l List) { // ERROR " l does not escape"
1398 for p = &l; p.Next != nil; p = p.Next { // ERROR "&l does not escape"
1403 // issue 7934: missed ... if element type had no pointers
1407 func foo150(x ...byte) { // ERROR "leaking param: x"
1412 foo150(1, 2, 3) // ERROR "[.][.][.] argument escapes to heap"
1415 // issue 7931: bad handling of slice of array
1419 func foo151(x *int) { // ERROR "leaking param: x"
1424 var a [64]int // ERROR "moved to heap: a"
1426 foo151(&(&a)[4:8][0]) // ERROR "&\(&a\)\[4:8\]\[0\] escapes to heap" "&a escapes to heap"
1430 var a [10]int // ERROR "moved to heap: a"
1431 b := a[:] // ERROR "a escapes to heap"
1432 foo151(&b[4:8][0]) // ERROR "&b\[4:8\]\[0\] escapes to heap"
1436 var a [64]int // ERROR "moved to heap: a"
1438 foo151(&(&a)[4:8:8][0]) // ERROR "&\(&a\)\[4:8:8\]\[0\] escapes to heap" "&a escapes to heap"
1442 var a [10]int // ERROR "moved to heap: a"
1443 b := a[:] // ERROR "a escapes to heap"
1444 foo151(&b[4:8:8][0]) // ERROR "&b\[4:8:8\]\[0\] escapes to heap"
1453 func (u *U) String() *string { // ERROR "leaking param u content to result ~r0"
1461 func NewV(u U) *V { // ERROR "leaking param: u"
1462 return &V{u.String()} // ERROR "&V literal escapes to heap" "u does not escape"
1466 a := "a" // ERROR "moved to heap: a"
1467 u := U{&a} // ERROR "&a escapes to heap"