Source file
test/abi/bad_internal_offsets.go
1
2
3
4
5
6
7
8
9
10 package genChecker0
11
12 var FailCount int
13
14
15 func NoteFailure(fidx int, pkg string, pref string, parmNo int, _ uint64) {
16 FailCount += 1
17 if FailCount > 10 {
18 panic("bad")
19 }
20 }
21
22
23 func NoteFailureElem(fidx int, pkg string, pref string, parmNo int, elem int, _ uint64) {
24 FailCount += 1
25 if FailCount > 10 {
26 panic("bad")
27 }
28 }
29
30 type StructF0S0 struct {
31 F0 int16
32 F1 string
33 F2 StructF0S1
34 }
35
36 type StructF0S1 struct {
37 _ uint16
38 }
39
40
41
42
43 func Test0(p0 uint32, p1 StructF0S0, p2 int32) {
44
45 var pad [256]uint64
46 pad[FailCount]++
47 if p0 == 0 {
48 return
49 }
50 p1f0c := int16(-3096)
51 if p1.F0 != p1f0c {
52 NoteFailureElem(0, "genChecker0", "parm", 1, 0, pad[0])
53 return
54 }
55 p1f1c := "f6ꂅ8ˋ<"
56 if p1.F1 != p1f1c {
57 NoteFailureElem(0, "genChecker0", "parm", 1, 1, pad[0])
58 return
59 }
60 p1f2c := StructF0S1{}
61 if p1.F2 != p1f2c {
62 NoteFailureElem(0, "genChecker0", "parm", 1, 2, pad[0])
63 return
64 }
65 p2f0c := int32(496713155)
66 if p2 != p2f0c {
67 NoteFailureElem(0, "genChecker0", "parm", 2, 0, pad[0])
68 return
69 }
70
71 Test0(p0-1, p1, p2)
72 return
73
74 }
75
View as plain text