summaryrefslogtreecommitdiff
path: root/test/regression/bitfields5.c
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-09-01 07:08:02 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2010-09-01 07:08:02 +0000
commit1b8e228a2c5d8f63ffa28c1fcef68f64a0408900 (patch)
treeaf62ff7abe9b492c132b53b9215d401544530dd6 /test/regression/bitfields5.c
parente99d18c442c40a14e6eaea722cbc7ef0ca6dd26a (diff)
Bugs with 1- empty bitfields, 2- anonymous bitfields, 3- result type of reading a small unsigned bitfield
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1496 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression/bitfields5.c')
-rw-r--r--test/regression/bitfields5.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/regression/bitfields5.c b/test/regression/bitfields5.c
new file mode 100644
index 0000000..169098e
--- /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;
+}