diff options
author | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
---|---|---|
committer | Carlo Zancanaro <carlo@pc-4w14-0.cs.usyd.edu.au> | 2012-10-15 17:10:06 +1100 |
commit | be1de4be954c80875ad4108e0a33e8e131b2f2c0 (patch) | |
tree | 1fbbecf276bf7c7bdcbb4dd446099d6d90eaa516 /clang/test/CodeGen/ms_struct-pack.c | |
parent | c4626a62754862d20b41e8a46a3574264ea80e6d (diff) | |
parent | f1bd2e48c5324d3f7cda4090c87f8a5b6f463ce2 (diff) |
Merge branch 'master' of ssh://bitbucket.org/czan/honours
Diffstat (limited to 'clang/test/CodeGen/ms_struct-pack.c')
-rw-r--r-- | clang/test/CodeGen/ms_struct-pack.c | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/clang/test/CodeGen/ms_struct-pack.c b/clang/test/CodeGen/ms_struct-pack.c new file mode 100644 index 0000000..da94f54 --- /dev/null +++ b/clang/test/CodeGen/ms_struct-pack.c @@ -0,0 +1,125 @@ +// RUN: %clang_cc1 -emit-llvm-only -triple i386-apple-darwin9 %s +// rdar://8823265 + +#pragma pack(1) +struct _one_ms { + short m:9; // size is 2 + int q:27; // size is 6 + short w:13; // size is 8 + short e:3; // size is 8 + char r:4; // size is 9 + char t:7; // size is 10 + short y:16; // size is 12 + short u:1; // size is 14 + char i:2; // size is 15 + int a; // size is 19 + char o:6; // size is 20 + char s:2; // size is 20 + short d:10; // size is 22 + short f:4; // size is 22 + char b; // size is 23 + char g:1; // size is 24 + short h:13; // size is 26 + char j:8; // size is 27 + char k:5; // size is 28 + char c; // size is 29 + int l:28; // size is 33 + char z:7; // size is 34 + int x:20; // size is 38 +} __attribute__((__ms_struct__)); +typedef struct _one_ms one_ms; + +static int a1[(sizeof(one_ms) == 38) - 1]; + +#pragma pack(2) +struct _two_ms { + short m:9; + int q:27; + short w:13; + short e:3; + char r:4; + char t:7; + short y:16; + short u:1; + char i:2; + int a; + char o:6; + char s:2; + short d:10; + short f:4; + char b; + char g:1; + short h:13; + char j:8; + char k:5; + char c; + int l:28; + char z:7; + int x:20; +} __attribute__((__ms_struct__)); + +typedef struct _two_ms two_ms; + +static int a2[(sizeof(two_ms) == 42) - 1]; + +#pragma pack(4) +struct _four_ms { + short m:9; + int q:27; + short w:13; + short e:3; + char r:4; + char t:7; + short y:16; + short u:1; + char i:2; + int a; + char o:6; + char s:2; + short d:10; + short f:4; + char b; + char g:1; + short h:13; + char j:8; + char k:5; + char c; + int l:28; + char z:7; + int x:20; +} __attribute__((__ms_struct__)); +typedef struct _four_ms four_ms; + +static int a4[(sizeof(four_ms) == 48) - 1]; + +#pragma pack(8) +struct _eight_ms { + short m:9; + int q:27; + short w:13; + short e:3; + char r:4; + char t:7; + short y:16; + short u:1; + char i:2; + int a; + char o:6; + char s:2; + short d:10; + short f:4; + char b; + char g:1; + short h:13; + char j:8; + char k:5; + char c; + int l:28; + char z:7; + int x:20; +} __attribute__((__ms_struct__)); + +typedef struct _eight_ms eight_ms; + +static int a8[(sizeof(eight_ms) == 48) - 1]; + |