Source file
test/fixedbugs/issue78303_2.go
1
2
3
4
5
6
7 package main
8
9 var n = 1
10
11
12 func bug(a func(int)) {
13 m := int64(len("x"[:n]))
14
15 for i, j := int64(1<<63-1), 0; i > m; i, j = i-(1<<62), j+1 {
16 if j == 2 {
17 a(3)
18 return
19 }
20 }
21 a(2)
22 }
23
24 func main() {
25 var r int
26 var set bool
27 bug(func(x int) {
28 if set {
29 panic("called twice")
30 }
31 set = true
32 r = x
33 })
34 if !set {
35 panic("not called")
36 }
37 if r != 2 {
38 panic("got wrong result")
39 }
40 }
41
View as plain text