brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · 83f8fc9 Raw
143 lines · c
1// RUN: %clang_cc1 -emit-llvm-only  -triple i386-apple-darwin9 -fdump-record-layouts %s | FileCheck %s2 3#pragma pack(1)4struct _one_ms {5        short m:9;      // size is 26        int q:27;       // size is 67        short w:13;     // size is 88        short e:3;      // size is 89        char r:4;       // size is 910        char t:7;       // size is 1011        short y:16;     // size is 1212        short u:1;      // size is 1413        char i:2;       // size is 1514        int a;          // size is 1915        char o:6;       // size is 2016        char s:2;       // size is 2017        short d:10;     // size is 2218        short f:4;      // size is 2219        char b;         // size is 2320        char g:1;       // size is 2421        short h:13;     // size is 2622        char j:8;       // size is 2723        char k:5;       // size is 2824        char c;         // size is 2925        int l:28;       // size is 3326        char z:7;       // size is 3427        int x:20;       // size is 3828} __attribute__((__ms_struct__));29typedef struct _one_ms one_ms;30 31static int a1[(sizeof(one_ms) == 38) - 1];32 33#pragma pack(2)34struct _two_ms {35        short m:9;      36        int q:27;       37        short w:13;     38        short e:3;      39        char r:4;       40        char t:7;       41        short y:16;     42        short u:1;      43        char i:2;       44        int a;          45        char o:6;       46        char s:2;       47        short d:10;     48        short f:4;      49        char b;         50        char g:1;       51        short h:13;     52        char j:8;       53        char k:5;       54        char c;         55        int l:28;       56        char z:7;       57        int x:20;       58} __attribute__((__ms_struct__));59 60typedef struct _two_ms two_ms;61 62static int a2[(sizeof(two_ms) == 42) - 1];63 64#pragma pack(4)65struct _four_ms {66        short m:9;      67        int q:27;       68        short w:13;     69        short e:3;      70        char r:4;       71        char t:7;       72        short y:16;     73        short u:1;      74        char i:2;       75        int a;          76        char o:6;       77        char s:2;       78        short d:10;     79        short f:4;      80        char b;         81        char g:1;       82        short h:13;     83        char j:8;       84        char k:5;       85        char c;         86        int l:28;       87        char z:7;       88        int x:20;       89} __attribute__((__ms_struct__));90typedef struct _four_ms four_ms;91 92static int a4[(sizeof(four_ms) == 48) - 1];93 94#pragma pack(8)95struct _eight_ms {96        short m:9;      97        int q:27;       98        short w:13;     99        short e:3;      100        char r:4;       101        char t:7;       102        short y:16;     103        short u:1;      104        char i:2;       105        int a;          106        char o:6;       107        char s:2;       108        short d:10;     109        short f:4;      110        char b;         111        char g:1;       112        short h:13;     113        char j:8;       114        char k:5;       115        char c;         116        int l:28;       117        char z:7;       118        int x:20;       119} __attribute__((__ms_struct__));120 121typedef struct _eight_ms eight_ms;122 123static int a8[(sizeof(eight_ms) == 48) - 1];124 125#pragma pack(2)126struct test0 {127  unsigned long a : 8;128  unsigned long b : 8;129  unsigned long c : 8;130  unsigned long d : 10;131  unsigned long e : 1;132} __attribute__((__ms_struct__));133 134// CHECK:             0 | struct test0135// CHECK-NEXT:    0:0-7 |   unsigned long a136// CHECK-NEXT:    1:0-7 |   unsigned long b137// CHECK-NEXT:    2:0-7 |   unsigned long c138// CHECK-NEXT:    4:0-9 |   unsigned long d139// CHECK-NEXT:    5:2-2 |   unsigned long e140// CHECK-NEXT:          | [sizeof=8, align=2]141 142static int test0[(sizeof(struct test0) == 8) ? 1 : -1];143