Source file
test/fixedbugs/issue71932.go
1
2
3
4
5
6
7 package main
8
9 import "runtime"
10
11 const C = 16
12
13 type T [C * C]byte
14
15 func main() {
16 var ts []*T
17
18 for i := 0; i < 100; i++ {
19 t := new(T)
20
21 if i%2 == 0 {
22 ts = append(ts, t)
23 }
24 }
25
26 runtime.GC()
27
28 for _, t := range ts {
29 f(t, C, C)
30 }
31 }
32
33
34 func f(t *T, i, j uint) {
35 if i == 0 || i > C || j == 0 || j > C {
36 return
37 }
38 p := &t[i*j-1]
39 *p = 0
40 runtime.GC()
41 *p = 0
42
43
44
45
46
47
48
49
50 }
51
View as plain text