aboutsummaryrefslogtreecommitdiffstats
path: root/test/regression
diff options
context:
space:
mode:
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/Results/bitfields23
-rw-r--r--test/regression/bitfields2.c32
2 files changed, 35 insertions, 0 deletions
diff --git a/test/regression/Results/bitfields2 b/test/regression/Results/bitfields2
new file mode 100644
index 00000000..0ab7773f
--- /dev/null
+++ b/test/regression/Results/bitfields2
@@ -0,0 +1,3 @@
+x = { a = 1, b = 2 }
+y = { c = 3, d = 0; e = 5 }
+z = { f = 6, g = 7; h = 8 }
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);
+}
+