aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression/bitfields2.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/regression/bitfields2.c')
-rw-r--r--test/regression/bitfields2.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/regression/bitfields2.c b/test/regression/bitfields2.c
new file mode 100644
index 00000000..b555f1eb
--- /dev/null
+++ b/test/regression/bitfields2.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+
+struct s {
+ signed char a: 6;
+ unsigned int b: 2;
+};
+
+struct t {
+ unsigned int c: 16;
+ unsigned int d: 1;
+ short e: 8;
+};
+
+struct u {
+ unsigned int f: 18;
+ unsigned int g: 24;
+ char h;
+};
+
+struct s x = { 1, 2 };
+
+struct t y = { 3, 4, 5 };
+
+struct u z = { 6, 7, 8 };
+
+int main()
+{
+ printf("x = { a = %d, b = %d }\n", x.a, x.b);
+ printf("y = { c = %d, d = %d; e = %d }\n", y.c, y.d, y.e);
+ printf("z = { f = %d, g = %d; h = %d }\n", z.f, z.g, z.h);
+}
+