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