diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-09-01 07:08:02 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2010-09-01 07:08:02 +0000 |
commit | 1b8e228a2c5d8f63ffa28c1fcef68f64a0408900 (patch) | |
tree | af62ff7abe9b492c132b53b9215d401544530dd6 /test/regression | |
parent | e99d18c442c40a14e6eaea722cbc7ef0ca6dd26a (diff) | |
download | compcert-1b8e228a2c5d8f63ffa28c1fcef68f64a0408900.tar.gz compcert-1b8e228a2c5d8f63ffa28c1fcef68f64a0408900.zip |
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')
-rw-r--r-- | test/regression/Makefile | 1 | ||||
-rw-r--r-- | test/regression/Results/bitfields5 | 2 | ||||
-rw-r--r-- | test/regression/Results/bitfields6 | 2 | ||||
-rw-r--r-- | test/regression/bitfields5.c | 28 | ||||
-rw-r--r-- | test/regression/bitfields6.c | 18 |
5 files changed, 51 insertions, 0 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile index 06ad9efe..44e1718e 100644 --- a/test/regression/Makefile +++ b/test/regression/Makefile @@ -8,6 +8,7 @@ LIBS=$(LIBMATH) # Can run and have reference output in Results TESTS=bitfields1 bitfields2 bitfields3 bitfields4 \ + bitfields5 bitfields6 \ expr1 initializers volatile2 \ funct3 expr5 struct7 struct8 casts1 casts2 diff --git a/test/regression/Results/bitfields5 b/test/regression/Results/bitfields5 new file mode 100644 index 00000000..1734b083 --- /dev/null +++ b/test/regression/Results/bitfields5 @@ -0,0 +1,2 @@ +f0 = 1, f1 = 2, f2 = 3, second = 3 +f0 = 123, f1 = 4, f2 = 56, second = 56 diff --git a/test/regression/Results/bitfields6 b/test/regression/Results/bitfields6 new file mode 100644 index 00000000..7cf930c6 --- /dev/null +++ b/test/regression/Results/bitfields6 @@ -0,0 +1,2 @@ +g = 0 +h = 1 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; +} diff --git a/test/regression/bitfields6.c b/test/regression/bitfields6.c new file mode 100644 index 00000000..3c2dcbe5 --- /dev/null +++ b/test/regression/bitfields6.c @@ -0,0 +1,18 @@ +#include <stdio.h> + +struct S0 { + unsigned f : 10; +}; + +struct S1 { + unsigned f : 32; +}; + +int main(void) +{ + struct S0 l = {1}; + struct S1 m = {1}; + printf("g = %d\n", (-1 >= l.f)); + printf("h = %d\n", (-1 >= m.f)); + return 0; +} |