From fe8baff11737d3785ff51d20ace9ab31665cd295 Mon Sep 17 00:00:00 2001 From: xleroy Date: Thu, 12 May 2011 09:41:09 +0000 Subject: cparser: support for attributes over struct and union. cparser: added experimental emulation of packed structs (PackedStruct.ml) git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1650 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- test/regression/attribs1.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'test/regression/attribs1.c') diff --git a/test/regression/attribs1.c b/test/regression/attribs1.c index a02f7188..b6e5c22d 100644 --- a/test/regression/attribs1.c +++ b/test/regression/attribs1.c @@ -24,6 +24,16 @@ __attribute((__section__("myconst"))) const int f = 34; __attribute((__section__("mycode"))) int myfunc(int x) { return x + 1; } +/* Alignment with typedefs and structs */ + +struct __attribute((__aligned__(8))) mystruct { char c1, c2; }; +char filler5 = 1; +struct mystruct u; + +typedef __attribute((__aligned__(8))) int myint; +char filler6 = 1; +myint v; + /* Test harness */ int main() @@ -32,8 +42,8 @@ int main() printf("Address of b = %u mod 8\n", ((unsigned int) &b) & 0x7); printf("Delta d - c = %u\n", ((unsigned int) &d) - ((unsigned int) &c)); printf("Delta f - e = %u\n", ((unsigned int) &f) - ((unsigned int) &e)); + printf("Address of u = %u mod 8\n", ((unsigned int) &u) & 0x7); + printf("Address of v = %u mod 8\n", ((unsigned int) &v) & 0x7); + return 0; } - - - -- cgit