1
2
3
4
5
6
7 package checktest
8
9 import (
10 _ "crypto/internal/fips140/check"
11 "runtime"
12 _ "unsafe"
13 )
14
15 var NOPTRDATA int = 1
16
17
18
19
20
21 var RODATA int32
22
23
24
25
26 var DATA = struct {
27 P *int
28 X int
29 }{&NOPTRDATA, 3}
30
31 var NOPTRBSS int
32
33 var BSS *int
34
35 func TEXT() {}
36
37 var (
38 globl12 [12]byte
39 globl8 [8]byte
40 )
41
42 func init() {
43 globl8 = [8]byte{1, 2, 3, 4, 5, 6, 7, 8}
44 globl12 = [12]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}
45 runtime.Gosched()
46
47 sum := byte(0)
48 for _, x := range globl12 {
49 sum += x
50 }
51 if sum != 78 {
52 panic("globl12 did not sum properly")
53 }
54
55 sum = byte(0)
56 for _, x := range globl8 {
57 sum += x
58 }
59 if sum != 36 {
60 panic("globl8 did not sum properly")
61 }
62 }
63
View as plain text