Source file
test/fixedbugs/issue27201.go
1
2
3
4
5
6
7 package main
8
9 import (
10 "runtime"
11 "strings"
12 )
13
14 func main() {
15 f(nil)
16 }
17
18 func f(p *int32) {
19 defer checkstack()
20 v := *p
21 sink = int64(v)
22 }
23
24 var sink int64
25
26 func checkstack() {
27 _ = recover()
28 var buf [1024]byte
29 n := runtime.Stack(buf[:], false)
30 s := string(buf[:n])
31 if strings.Contains(s, "issue27201.go:21 ") {
32 panic("panic at wrong location")
33 }
34 if !strings.Contains(s, "issue27201.go:20 ") {
35 panic("no panic at correct location")
36 }
37 }
38
View as plain text