Source file
test/escape_indir.go
1
2
3
4
5
6
7
8
9 package escape
10
11 var sink interface{}
12
13 type ConstPtr struct {
14 p *int
15 c ConstPtr2
16 x **ConstPtr
17 }
18
19 type ConstPtr2 struct {
20 p *int
21 i int
22 }
23
24 func constptr0() {
25 i := 0
26 x := &ConstPtr{}
27
28 x.p = &i
29 _ = x
30 }
31
32 func constptr01() *ConstPtr {
33 i := 0
34 x := &ConstPtr{}
35 x.p = &i
36 return x
37 }
38
39 func constptr02() ConstPtr {
40 i := 0
41 x := &ConstPtr{}
42 x.p = &i
43 return *x
44 }
45
46 func constptr03() **ConstPtr {
47 i := 0
48 x := &ConstPtr{}
49 x.p = &i
50 return &x
51 }
52
53 func constptr1() {
54 i := 0
55 x := &ConstPtr{}
56 x.p = &i
57 sink = x
58 }
59
60 func constptr2() {
61 i := 0
62 x := &ConstPtr{}
63 x.p = &i
64 sink = *x
65 }
66
67 func constptr4() *ConstPtr {
68 p := new(ConstPtr)
69 *p = *&ConstPtr{}
70 return p
71 }
72
73 func constptr5() *ConstPtr {
74 p := new(ConstPtr)
75 p1 := &ConstPtr{}
76 *p = *p1
77 return p
78 }
79
80
81 func constptr6(p *ConstPtr) {
82 p1 := &ConstPtr{}
83 *p1 = *p
84 _ = p1
85 }
86
87 func constptr7() **ConstPtr {
88 p := new(ConstPtr)
89 var tmp ConstPtr2
90 p1 := &tmp
91 p.c = *p1
92 return &p
93 }
94
95 func constptr8() *ConstPtr {
96 p := new(ConstPtr)
97 var tmp ConstPtr2
98 p.c = *&tmp
99 return p
100 }
101
102 func constptr9() ConstPtr {
103 p := new(ConstPtr)
104 var p1 ConstPtr2
105 i := 0
106 p1.p = &i
107 p.c = p1
108 return *p
109 }
110
111 func constptr10() ConstPtr {
112 x := &ConstPtr{}
113 i := 0
114 var p *ConstPtr
115 p = &ConstPtr{p: &i, x: &x}
116 var pp **ConstPtr
117 pp = &p
118 return **pp
119 }
120
121 func constptr11() *ConstPtr {
122 i := 0
123 p := new(ConstPtr)
124 p1 := &ConstPtr{}
125 p1.p = &i
126 *p = *p1
127 return p
128 }
129
130 func foo(p **int) {
131 i := 0
132 y := p
133 *y = &i
134 }
135
136 func foo1(p *int) {
137 i := 0
138 y := &p
139 *y = &i
140 }
141
142 func foo2() {
143 type Z struct {
144 f **int
145 }
146 x := new(int)
147 sink = &x
148 var z Z
149 z.f = &x
150 p := z.f
151 i := 0
152 *p = &i
153 }
154
155 var global *byte
156
157 func f() {
158 var x byte
159 global = &*&x
160 }
161
View as plain text