1 // $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug260 failed
3 // Test that structures pack densely, according to the alignment of the largest field.
13 type T1
struct { x
uint8 }
14 type T2
struct { x
uint16 }
15 type T4
struct { x
uint32 }
18 report
:= len(os
.Args
) > 1
21 a0
, _
:= strconv
.Btoui64(fmt
.Sprintf("%p", &b1
[0])[2:], 16)
22 a1
, _
:= strconv
.Btoui64(fmt
.Sprintf("%p", &b1
[1])[2:], 16)
26 fmt
.Println("alignment should be 1, is", a1
-a0
)
31 a0
, _
= strconv
.Btoui64(fmt
.Sprintf("%p", &b2
[0])[2:], 16)
32 a1
, _
= strconv
.Btoui64(fmt
.Sprintf("%p", &b2
[1])[2:], 16)
39 fmt
.Println("alignment should be 2, is", a1
-a0
)
43 a0
, _
= strconv
.Btoui64(fmt
.Sprintf("%p", &b4
[0])[2:], 16)
44 a1
, _
= strconv
.Btoui64(fmt
.Sprintf("%p", &b4
[1])[2:], 16)
51 fmt
.Println("alignment should be 4, is", a1
-a0
)