1 // Copyright 2020 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.
7 // Test passing C struct to exported Go function.
13 // T is a C struct with alignment padding after b.
14 // The padding bytes are not considered initialized by MSAN.
15 // It is big enough to be passed on stack in C ABI (and least
17 typedef struct { char b; uintptr_t x, y; } T;
21 // Use weak as a hack to permit defining a function even though we use export.
22 void CF(int x) __attribute__ ((weak));
24 T *t = malloc(sizeof(T));
34 func F(t C.T) { println(t.b, t.x, t.y) }