diff options
Diffstat (limited to 'test/regression/bitfields5.c')
-rw-r--r-- | test/regression/bitfields5.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/regression/bitfields5.c b/test/regression/bitfields5.c new file mode 100644 index 00000000..169098e7 --- /dev/null +++ b/test/regression/bitfields5.c @@ -0,0 +1,28 @@ +#include <stdio.h> + +struct S1 { + unsigned f0 : 13; + unsigned : 6; + unsigned f1 : 5; + unsigned : 0; + unsigned f2 : 8; +}; + +struct S1 g_207 = {1,2,3}; + +void print_S1(struct S1 * p) +{ + printf("f0 = %u, f1 = %u, f2 = %u, second = %u\n", + p->f0, p->f1, p->f2, + *((unsigned char *)p + 4)); +} + +int main() +{ + struct S1 x; + + print_S1(&g_207); + x.f0 = 123; x.f1 = 4; x.f2 = 56; + print_S1(&x); + return 0; +} |