summaryrefslogtreecommitdiff
path: root/test/regression/packedstruct1.c
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-11-26 15:40:57 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-11-26 15:40:57 +0000
commit60b6624ae2b28ebe9fb30c2aa6115e4d5c1ab436 (patch)
treea78b0a79576773ead96a8d39902ad3a19b20ed2d /test/regression/packedstruct1.c
parent015c64c64a5a547dcef81a75a589eeaf034654cd (diff)
cparser/*: refactoring of the expansion of read-modify-write operators
cparser/PackedStructs: treat r-m-w operations over byte-swapped fields cparser/PackedStructs: allow static initialization of packed structs test/regression: more packedstruct tests git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1738 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression/packedstruct1.c')
-rw-r--r--test/regression/packedstruct1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/regression/packedstruct1.c b/test/regression/packedstruct1.c
index cecd1f3..66c8c9e 100644
--- a/test/regression/packedstruct1.c
+++ b/test/regression/packedstruct1.c
@@ -52,6 +52,7 @@ struct s3 {
signed int w;
char * p;
unsigned int t[3];
+ unsigned char s[2];
};
struct s3 s3;
@@ -61,6 +62,7 @@ void test3(void)
char xx;
printf("sizeof(struct s3) = %d\n", sizeof(struct s3));
+ printf("offsetof(s) = %d\n", offsetof(s3,s));
s3.x = 123;
s3.y = 45678;
s3.z = 0x80000001U;
@@ -70,10 +72,13 @@ void test3(void)
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.s[0] = 'o';
+ s3.s[1] = 'k';
+ printf("s3 = {x = %u, y = %u, z = %u, v = %d, w = %d, p is %s, t = {%d,%d,%d}, s = {'%c','%c'}}\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]);
+ s3.t[0], s3.t[1], s3.t[2],
+ s3.s[0], s3.s[1]);
}
/* Back to normal */