Source file
test/abi/part_live.go
1
2
3
4
5
6
7
8
9 package main
10
11 import "runtime"
12 import "unsafe"
13
14
15 func F(s []int) {
16 for i, x := range s {
17 G(i, x)
18 }
19 GC()
20 G(len(s), cap(s))
21 GC()
22 }
23
24
25
26 func G(int, int) {}
27
28
29 func GC() { runtime.GC(); runtime.GC() }
30
31 func main() {
32 s := make([]int, 3)
33 escape(s)
34 p := int(uintptr(unsafe.Pointer(&s[2])) + 42)
35 poison([3]int{p, p, p})
36 F(s)
37 }
38
39
40
41 func poison([3]int) {}
42
43
44
45 func escape(s []int) {
46 g = s
47 }
48 var g []int
49
View as plain text