1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-darwin9 %s 2*f4a2713aSLionel Sambuc // rdar://8823265 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc #define ATTR __attribute__((__ms_struct__)) 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc struct { 7*f4a2713aSLionel Sambuc unsigned int bf_1 : 12; 8*f4a2713aSLionel Sambuc unsigned int : 0; 9*f4a2713aSLionel Sambuc unsigned int bf_2 : 12; 10*f4a2713aSLionel Sambuc } ATTR t1; 11*f4a2713aSLionel Sambuc static int a1[(sizeof(t1) == 8) -1]; 12*f4a2713aSLionel Sambuc 13*f4a2713aSLionel Sambuc struct 14*f4a2713aSLionel Sambuc { 15*f4a2713aSLionel Sambuc char foo : 4; 16*f4a2713aSLionel Sambuc short : 0; 17*f4a2713aSLionel Sambuc char bar; 18*f4a2713aSLionel Sambuc } ATTR t2; 19*f4a2713aSLionel Sambuc static int a2[(sizeof(t2) == 4) -1]; 20*f4a2713aSLionel Sambuc 21*f4a2713aSLionel Sambuc #pragma ms_struct on 22*f4a2713aSLionel Sambuc struct 23*f4a2713aSLionel Sambuc { 24*f4a2713aSLionel Sambuc char foo : 4; 25*f4a2713aSLionel Sambuc short : 0; 26*f4a2713aSLionel Sambuc char bar; 27*f4a2713aSLionel Sambuc } t3; 28*f4a2713aSLionel Sambuc #pragma ms_struct off 29*f4a2713aSLionel Sambuc static int a3[(sizeof(t3) == 4) -1]; 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc struct 32*f4a2713aSLionel Sambuc { 33*f4a2713aSLionel Sambuc char foo : 6; 34*f4a2713aSLionel Sambuc long : 0; 35*f4a2713aSLionel Sambuc } ATTR t4; 36*f4a2713aSLionel Sambuc static int a4[(sizeof(t4) == 8) -1]; 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc struct 39*f4a2713aSLionel Sambuc { 40*f4a2713aSLionel Sambuc char foo : 4; 41*f4a2713aSLionel Sambuc short : 0; 42*f4a2713aSLionel Sambuc char bar : 8; 43*f4a2713aSLionel Sambuc } ATTR t5; 44*f4a2713aSLionel Sambuc static int a5[(sizeof(t5) == 4) -1]; 45*f4a2713aSLionel Sambuc 46*f4a2713aSLionel Sambuc struct 47*f4a2713aSLionel Sambuc { 48*f4a2713aSLionel Sambuc char foo : 4; 49*f4a2713aSLionel Sambuc short : 0; 50*f4a2713aSLionel Sambuc long : 0; 51*f4a2713aSLionel Sambuc char bar; 52*f4a2713aSLionel Sambuc } ATTR t6; 53*f4a2713aSLionel Sambuc static int a6[(sizeof(t6) == 4) -1]; 54*f4a2713aSLionel Sambuc 55*f4a2713aSLionel Sambuc struct 56*f4a2713aSLionel Sambuc { 57*f4a2713aSLionel Sambuc char foo : 4; 58*f4a2713aSLionel Sambuc long : 0; 59*f4a2713aSLionel Sambuc short : 0; 60*f4a2713aSLionel Sambuc char bar; 61*f4a2713aSLionel Sambuc } ATTR t7; 62*f4a2713aSLionel Sambuc static int a7[(sizeof(t7) == 16) -1]; 63*f4a2713aSLionel Sambuc 64*f4a2713aSLionel Sambuc struct 65*f4a2713aSLionel Sambuc { 66*f4a2713aSLionel Sambuc char foo : 4; 67*f4a2713aSLionel Sambuc short : 0; 68*f4a2713aSLionel Sambuc long : 0; 69*f4a2713aSLionel Sambuc char bar:7; 70*f4a2713aSLionel Sambuc } ATTR t8; 71*f4a2713aSLionel Sambuc static int a8[(sizeof(t8) == 4) -1]; 72*f4a2713aSLionel Sambuc 73*f4a2713aSLionel Sambuc struct 74*f4a2713aSLionel Sambuc { 75*f4a2713aSLionel Sambuc char foo : 4; 76*f4a2713aSLionel Sambuc long : 0; 77*f4a2713aSLionel Sambuc short : 0; 78*f4a2713aSLionel Sambuc char bar: 8; 79*f4a2713aSLionel Sambuc } ATTR t9; 80*f4a2713aSLionel Sambuc static int a9[(sizeof(t9) == 16) -1]; 81*f4a2713aSLionel Sambuc 82*f4a2713aSLionel Sambuc struct 83*f4a2713aSLionel Sambuc { 84*f4a2713aSLionel Sambuc char foo : 4; 85*f4a2713aSLionel Sambuc char : 0; 86*f4a2713aSLionel Sambuc short : 0; 87*f4a2713aSLionel Sambuc int : 0; 88*f4a2713aSLionel Sambuc long :0; 89*f4a2713aSLionel Sambuc char bar; 90*f4a2713aSLionel Sambuc } ATTR t10; 91*f4a2713aSLionel Sambuc static int a10[(sizeof(t10) == 2) -1]; 92