summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-10-16 07:37:28 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-10-16 07:37:28 +0000
commit7e378c0215c99d7f8bd38341081ec04fd202fd0a (patch)
tree1a17a6568e1c421c2543d3576c97f9296ca15179 /test
parente8bd77565422ab8e6d2fdd4ec7d5e7e4916ff2bd (diff)
Revised emulation of packed structs
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1729 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test')
-rw-r--r--test/regression/Results/packedstruct14
-rw-r--r--test/regression/packedstruct1.c14
2 files changed, 14 insertions, 4 deletions
diff --git a/test/regression/Results/packedstruct1 b/test/regression/Results/packedstruct1
index fe19bff..7549132 100644
--- a/test/regression/Results/packedstruct1
+++ b/test/regression/Results/packedstruct1
@@ -7,8 +7,8 @@ sizeof(struct s2) = 16
offsetof(x) = 0, offsetof(y) = 2, offsetof(z) = 6
s2 = {x = 57, y = -456, z = 3.14159}
-sizeof(struct s3) = 13
-s3 = {x = 123, y = 45678, z = 2147483649, v = -456, w = -1234567}
+sizeof(struct s3) = 29
+s3 = {x = 123, y = 45678, z = 2147483649, v = -456, w = -1234567, p is ok, t = {111,222,333}}
sizeof(struct s4) = 16
offsetof(x) = 0, offsetof(y) = 4, offsetof(z) = 8
diff --git a/test/regression/packedstruct1.c b/test/regression/packedstruct1.c
index 1bde780..cecd1f3 100644
--- a/test/regression/packedstruct1.c
+++ b/test/regression/packedstruct1.c
@@ -50,20 +50,30 @@ struct s3 {
unsigned int z;
signed short v;
signed int w;
+ char * p;
+ unsigned int t[3];
};
struct s3 s3;
void test3(void)
{
+ char xx;
+
printf("sizeof(struct s3) = %d\n", sizeof(struct s3));
s3.x = 123;
s3.y = 45678;
s3.z = 0x80000001U;
s3.v = -456;
s3.w = -1234567;
- printf("s3 = {x = %u, y = %u, z = %u, v = %d, w = %d}\n\n",
- s3.x, s3.y, s3.z, s3.v, s3.w);
+ s3.p = &xx;
+ s3.t[0] = 111;
+ s3.t[1] = 222;
+ s3.t[2] = 333;
+ printf("s3 = {x = %u, y = %u, z = %u, v = %d, w = %d, p is %s, t = {%d,%d,%d}}\n\n",
+ s3.x, s3.y, s3.z, s3.v, s3.w,
+ (s3.p == &xx ? "ok" : "BAD"),
+ s3.t[0], s3.t[1], s3.t[2]);
}
/* Back to normal */