xref: /illumos-gate/usr/src/tools/smatch/src/validation/transparent-union.c (revision b210e77709da8e42dfe621e10ccf4be504206058)
1 struct a {
2 	int field;
3 };
4 struct b {
5 	int field;
6 };
7 
8 typedef union {
9 	struct a *a;
10 	struct b *b;
11 } transparent_arg __attribute__((__transparent_union__));
12 
13 static void foo(transparent_arg arg)
14 {
15 }
16 
17 static void bar(void)
18 {
19 	struct b arg = { 0 };
20 	foo((struct a *) &arg);
21 }
22 
23 /*
24  * check-name: Transparent union attribute.
25  */
26