Source file
test/fixedbugs/issue20780b.go
1
2
3
4
5
6
7
8
9
10
11
12 package main
13
14 import "fmt"
15
16 const N = 2e6
17
18 type Big = [N]int
19
20 var sink interface{}
21
22 func main() {
23 g(0, f(0))
24
25 x1 := f(1)
26 sink = &x1
27 g(1, x1)
28 g(7, f(7))
29 g(1, x1)
30
31 x3 := f(3)
32 sink = &x3
33 g(1, x1)
34 g(3, x3)
35
36 h(f(0), x1, f(2), x3, f(4))
37 }
38
39
40 func f(k int) (x Big) {
41 for i := range x {
42 x[i] = k*N + i
43 }
44 return
45 }
46
47
48 func g(k int, x Big) {
49 for i := range x {
50 if x[i] != k*N+i {
51 panic(fmt.Sprintf("x%d[%d] = %d", k, i, x[i]))
52 }
53 }
54 }
55
56
57 func h(x0, x1, x2, x3, x4 Big) {
58 g(0, x0)
59 g(1, x1)
60 g(2, x2)
61 g(3, x3)
62 g(4, x4)
63 }
64
View as plain text