OLD | NEW |
1 // errorcheck -0 -l -live | 1 // errorcheck -0 -l -live |
2 | 2 |
3 // Copyright 2014 The Go Authors. All rights reserved. | 3 // Copyright 2014 The Go Authors. All rights reserved. |
4 // Use of this source code is governed by a BSD-style | 4 // Use of this source code is governed by a BSD-style |
5 // license that can be found in the LICENSE file. | 5 // license that can be found in the LICENSE file. |
6 | 6 |
7 package main | 7 package main |
8 | 8 |
9 func f1() { | 9 func f1() { |
10 var x *int | 10 var x *int |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // similarly, select{} does not fall through. | 175 // similarly, select{} does not fall through. |
176 // this used to have a spurious "live at entry to f12: ~r0". | 176 // this used to have a spurious "live at entry to f12: ~r0". |
177 | 177 |
178 func f12() *int { | 178 func f12() *int { |
179 if b { | 179 if b { |
180 select{} | 180 select{} |
181 } else { | 181 } else { |
182 return nil | 182 return nil |
183 } | 183 } |
184 } | 184 } |
| 185 |
| 186 // incorrectly placed VARDEF annotations can cause missing liveness annotations. |
| 187 // this used to be missing the fact that s is live during the call to g13 (becau
se it is |
| 188 // needed for the call to h13). |
| 189 |
| 190 func f13() { |
| 191 s := "hello" |
| 192 s = h13(s, g13(s)) // ERROR "live at call to g13: s" |
| 193 } |
| 194 |
| 195 func g13(string) string |
| 196 func h13(string, string) string |
OLD | NEW |