1
// Copyright 2014 The Go Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
13
} __attribute__((__packed__)) misaligned;
18
return (uintptr_t)&((misaligned*)0)->y;
28
func test7560(t *testing.T) {
29
// some mingw don't implement __packed__ correctly.
30
if C.offset7560() != 1 {
31
t.Skip("C compiler did not pack struct")
34
// C.misaligned should have x but then a padding field to get to the end of the struct.
35
// There should not be a field named 'y'.
37
rt := reflect.TypeOf(&v).Elem()
38
if rt.NumField() != 2 || rt.Field(0).Name != "x" || rt.Field(1).Name != "_" {
39
t.Errorf("unexpected fields in C.misaligned:\n")
40
for i := 0; i < rt.NumField(); i++ {
41
t.Logf("%+v\n", rt.Field(i))