1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -emit-llvm-only -triple i386-apple-darwin9 -fdump-record-layouts %s | FileCheck %s 2f4a2713aSLionel Sambuc // rdar://8823265 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc #pragma pack(1) 5f4a2713aSLionel Sambuc struct _one_ms { 6f4a2713aSLionel Sambuc short m:9; // size is 2 7f4a2713aSLionel Sambuc int q:27; // size is 6 8f4a2713aSLionel Sambuc short w:13; // size is 8 9f4a2713aSLionel Sambuc short e:3; // size is 8 10f4a2713aSLionel Sambuc char r:4; // size is 9 11f4a2713aSLionel Sambuc char t:7; // size is 10 12f4a2713aSLionel Sambuc short y:16; // size is 12 13f4a2713aSLionel Sambuc short u:1; // size is 14 14f4a2713aSLionel Sambuc char i:2; // size is 15 15f4a2713aSLionel Sambuc int a; // size is 19 16f4a2713aSLionel Sambuc char o:6; // size is 20 17f4a2713aSLionel Sambuc char s:2; // size is 20 18f4a2713aSLionel Sambuc short d:10; // size is 22 19f4a2713aSLionel Sambuc short f:4; // size is 22 20f4a2713aSLionel Sambuc char b; // size is 23 21f4a2713aSLionel Sambuc char g:1; // size is 24 22f4a2713aSLionel Sambuc short h:13; // size is 26 23f4a2713aSLionel Sambuc char j:8; // size is 27 24f4a2713aSLionel Sambuc char k:5; // size is 28 25f4a2713aSLionel Sambuc char c; // size is 29 26f4a2713aSLionel Sambuc int l:28; // size is 33 27f4a2713aSLionel Sambuc char z:7; // size is 34 28f4a2713aSLionel Sambuc int x:20; // size is 38 29f4a2713aSLionel Sambuc } __attribute__((__ms_struct__)); 30f4a2713aSLionel Sambuc typedef struct _one_ms one_ms; 31f4a2713aSLionel Sambuc 32f4a2713aSLionel Sambuc static int a1[(sizeof(one_ms) == 38) - 1]; 33f4a2713aSLionel Sambuc 34f4a2713aSLionel Sambuc #pragma pack(2) 35f4a2713aSLionel Sambuc struct _two_ms { 36f4a2713aSLionel Sambuc short m:9; 37f4a2713aSLionel Sambuc int q:27; 38f4a2713aSLionel Sambuc short w:13; 39f4a2713aSLionel Sambuc short e:3; 40f4a2713aSLionel Sambuc char r:4; 41f4a2713aSLionel Sambuc char t:7; 42f4a2713aSLionel Sambuc short y:16; 43f4a2713aSLionel Sambuc short u:1; 44f4a2713aSLionel Sambuc char i:2; 45f4a2713aSLionel Sambuc int a; 46f4a2713aSLionel Sambuc char o:6; 47f4a2713aSLionel Sambuc char s:2; 48f4a2713aSLionel Sambuc short d:10; 49f4a2713aSLionel Sambuc short f:4; 50f4a2713aSLionel Sambuc char b; 51f4a2713aSLionel Sambuc char g:1; 52f4a2713aSLionel Sambuc short h:13; 53f4a2713aSLionel Sambuc char j:8; 54f4a2713aSLionel Sambuc char k:5; 55f4a2713aSLionel Sambuc char c; 56f4a2713aSLionel Sambuc int l:28; 57f4a2713aSLionel Sambuc char z:7; 58f4a2713aSLionel Sambuc int x:20; 59f4a2713aSLionel Sambuc } __attribute__((__ms_struct__)); 60f4a2713aSLionel Sambuc 61f4a2713aSLionel Sambuc typedef struct _two_ms two_ms; 62f4a2713aSLionel Sambuc 63f4a2713aSLionel Sambuc static int a2[(sizeof(two_ms) == 42) - 1]; 64f4a2713aSLionel Sambuc 65f4a2713aSLionel Sambuc #pragma pack(4) 66f4a2713aSLionel Sambuc struct _four_ms { 67f4a2713aSLionel Sambuc short m:9; 68f4a2713aSLionel Sambuc int q:27; 69f4a2713aSLionel Sambuc short w:13; 70f4a2713aSLionel Sambuc short e:3; 71f4a2713aSLionel Sambuc char r:4; 72f4a2713aSLionel Sambuc char t:7; 73f4a2713aSLionel Sambuc short y:16; 74f4a2713aSLionel Sambuc short u:1; 75f4a2713aSLionel Sambuc char i:2; 76f4a2713aSLionel Sambuc int a; 77f4a2713aSLionel Sambuc char o:6; 78f4a2713aSLionel Sambuc char s:2; 79f4a2713aSLionel Sambuc short d:10; 80f4a2713aSLionel Sambuc short f:4; 81f4a2713aSLionel Sambuc char b; 82f4a2713aSLionel Sambuc char g:1; 83f4a2713aSLionel Sambuc short h:13; 84f4a2713aSLionel Sambuc char j:8; 85f4a2713aSLionel Sambuc char k:5; 86f4a2713aSLionel Sambuc char c; 87f4a2713aSLionel Sambuc int l:28; 88f4a2713aSLionel Sambuc char z:7; 89f4a2713aSLionel Sambuc int x:20; 90f4a2713aSLionel Sambuc } __attribute__((__ms_struct__)); 91f4a2713aSLionel Sambuc typedef struct _four_ms four_ms; 92f4a2713aSLionel Sambuc 93f4a2713aSLionel Sambuc static int a4[(sizeof(four_ms) == 48) - 1]; 94f4a2713aSLionel Sambuc 95f4a2713aSLionel Sambuc #pragma pack(8) 96f4a2713aSLionel Sambuc struct _eight_ms { 97f4a2713aSLionel Sambuc short m:9; 98f4a2713aSLionel Sambuc int q:27; 99f4a2713aSLionel Sambuc short w:13; 100f4a2713aSLionel Sambuc short e:3; 101f4a2713aSLionel Sambuc char r:4; 102f4a2713aSLionel Sambuc char t:7; 103f4a2713aSLionel Sambuc short y:16; 104f4a2713aSLionel Sambuc short u:1; 105f4a2713aSLionel Sambuc char i:2; 106f4a2713aSLionel Sambuc int a; 107f4a2713aSLionel Sambuc char o:6; 108f4a2713aSLionel Sambuc char s:2; 109f4a2713aSLionel Sambuc short d:10; 110f4a2713aSLionel Sambuc short f:4; 111f4a2713aSLionel Sambuc char b; 112f4a2713aSLionel Sambuc char g:1; 113f4a2713aSLionel Sambuc short h:13; 114f4a2713aSLionel Sambuc char j:8; 115f4a2713aSLionel Sambuc char k:5; 116f4a2713aSLionel Sambuc char c; 117f4a2713aSLionel Sambuc int l:28; 118f4a2713aSLionel Sambuc char z:7; 119f4a2713aSLionel Sambuc int x:20; 120f4a2713aSLionel Sambuc } __attribute__((__ms_struct__)); 121f4a2713aSLionel Sambuc 122f4a2713aSLionel Sambuc typedef struct _eight_ms eight_ms; 123f4a2713aSLionel Sambuc 124f4a2713aSLionel Sambuc static int a8[(sizeof(eight_ms) == 48) - 1]; 125f4a2713aSLionel Sambuc 126*0a6a1f1dSLionel Sambuc // rdar://15926990 127*0a6a1f1dSLionel Sambuc #pragma pack(2) 128*0a6a1f1dSLionel Sambuc struct test0 { 129*0a6a1f1dSLionel Sambuc unsigned long a : 8; 130*0a6a1f1dSLionel Sambuc unsigned long b : 8; 131*0a6a1f1dSLionel Sambuc unsigned long c : 8; 132*0a6a1f1dSLionel Sambuc unsigned long d : 10; 133*0a6a1f1dSLionel Sambuc unsigned long e : 1; 134*0a6a1f1dSLionel Sambuc } __attribute__((__ms_struct__)); 135*0a6a1f1dSLionel Sambuc 136*0a6a1f1dSLionel Sambuc // CHECK: Type: struct test0 137*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Record: 138*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Layout: 139*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Size:64 140*0a6a1f1dSLionel Sambuc // CHECK-NEXT: DataSize:64 141*0a6a1f1dSLionel Sambuc // CHECK-NEXT: Alignment:16 142*0a6a1f1dSLionel Sambuc // CHECK-NEXT: FieldOffsets: [0, 8, 16, 32, 42]> 143*0a6a1f1dSLionel Sambuc 144*0a6a1f1dSLionel Sambuc static int test0[(sizeof(struct test0) == 8) ? 1 : -1]; 145