1 struct bfu {
2 unsigned int a:11;
3 unsigned int f:9;
4 unsigned int :2;
5 unsigned int z:3;
6 };
7
8 struct bfu bfuu_init(unsigned int a)
9 {
10 struct bfu bf = { .f = a, };
11 return bf;
12 }
13
14 struct bfu bfus_init(int a)
15 {
16 struct bfu bf = { .f = a, };
17 return bf;
18 }
19
20 unsigned int bfu_get0(void)
21 {
22 struct bfu bf = { };
23 return bf.f;
24 }
25
26
27 struct bfs {
28 signed int a:11;
29 signed int f:9;
30 signed int :2;
31 signed int z:3;
32 };
33
34 struct bfs bfsu_init(unsigned int a)
35 {
36 struct bfs bf = { .f = a, };
37 return bf;
38 }
39
40 struct bfs bfss_init(int a)
41 {
42 struct bfs bf = { .f = a, };
43 return bf;
44 }
45
46 int bfs_get0(void)
47 {
48 struct bfs bf = { };
49 return bf.f;
50 }
51
52 /*
53 * check-name: bitfield implicit init zero
54 * check-command: test-linearize -Wno-decl $file
55 *
56 * check-output-start
57 bfuu_init:
58 .L0:
59 <entry-point>
60 cast.9 %r2 <- (32) %arg1
61 shl.32 %r4 <- %r2, $11
62 ret.32 %r4
63
64
65 bfus_init:
66 .L2:
67 <entry-point>
68 scast.9 %r10 <- (32) %arg1
69 shl.32 %r12 <- %r10, $11
70 ret.32 %r12
71
72
73 bfu_get0:
74 .L4:
75 <entry-point>
76 ret.32 $0
77
78
79 bfsu_init:
80 .L6:
81 <entry-point>
82 cast.9 %r23 <- (32) %arg1
83 shl.32 %r25 <- %r23, $11
84 ret.32 %r25
85
86
87 bfss_init:
88 .L8:
89 <entry-point>
90 scast.9 %r31 <- (32) %arg1
91 shl.32 %r33 <- %r31, $11
92 ret.32 %r33
93
94
95 bfs_get0:
96 .L10:
97 <entry-point>
98 ret.32 $0
99
100
101 * check-output-end
102 */