1 #include <stdio.h>
2 #include <string.h>
3 
4 int
main()5 main() {
6 	/*
7 	 * Make sure a complete storage unit is allocated
8 	 */
9 	struct foo {
10 		int	bf:1;
11 		unsigned	:0;
12 	};
13 	struct bar {
14 		int	bf:1;
15 		unsigned	:0;
16 		char	x;
17 	};
18 	struct baz {
19 		int	bf:1;
20 		signed	:0;
21 		char	x;
22 		short	y;
23 	};
24 	struct bleh {
25 		int	bf:1;
26 		signed	:0;
27 		signed	:0;
28 		signed	:0;
29 		signed	:0;
30 		signed	:0;
31 		signed	:0;
32 		signed	:0;
33 		signed	:0;
34 		signed	:0;
35 		signed	:0;
36 		signed	:0;
37 		signed	:0;
38 		signed	:0;
39 		signed	:0;
40 		signed	:0;
41 		signed	:0;
42 		signed	:0;
43 		int	lolz:1;
44 		char	x;
45 		short	y;
46 	};
47 	struct bleh2 {
48 		int	x;
49 		signed	:0;  /* should have no effect */
50 		int	bf:1;
51 	};
52 
53 	/*
54 	 * Make sure the storage unit holding bf is correctly
55 	 * considered complete at the end of the struct (i.e.
56 	 * not padded)
57 	 */
58 	struct gnu {
59 		int	bf:1;
60 		char	x;
61 		char	y[2];
62 
63 		char 	z[4];
64 	};
65 
66 	printf("%d\n", (int)sizeof(struct foo));
67 	printf("%d\n", (int)sizeof(struct bar));
68 	printf("%d\n", (int)sizeof(struct baz));
69 	printf("%d\n", (int)sizeof(struct gnu));
70 	printf("%d\n", (int)sizeof(struct bleh));
71 	printf("%d\n", (int)sizeof(struct bleh2));
72 	return 0;
73 }
74 
75