Source file
test/fixedbugs/issue34123.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 import (
13 "fmt"
14 "runtime"
15 )
16
17 var x byte
18 var p *byte
19
20
21 func f() {
22 q := p
23 x = 11
24 *q = 12
25 }
26 func main() {
27 defer func() {
28 recover()
29 var pcs [10]uintptr
30 n := runtime.Callers(1, pcs[:])
31 frames := runtime.CallersFrames(pcs[:n])
32 for {
33 f, more := frames.Next()
34 if f.Function == "main.f" && f.Line != 24 {
35 panic(fmt.Errorf("expected line 24, got line %d", f.Line))
36 }
37 if !more {
38 break
39 }
40 }
41 }()
42 f()
43 }
44
View as plain text