1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm %s -o - 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc #ifdef PACKED 5*f4a2713aSLionel Sambuc // This is an example where size of Packed struct is smaller then 6*f4a2713aSLionel Sambuc // the size of bit field type. 7*f4a2713aSLionel Sambuc #define P __attribute__((packed)) 8*f4a2713aSLionel Sambuc #else 9*f4a2713aSLionel Sambuc #define P 10*f4a2713aSLionel Sambuc #endif 11*f4a2713aSLionel Sambuc 12*f4a2713aSLionel Sambuc struct P M_Packed { 13*f4a2713aSLionel Sambuc unsigned long long X:50; 14*f4a2713aSLionel Sambuc unsigned Y:2; 15*f4a2713aSLionel Sambuc }; 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambuc struct M_Packed sM_Packed; 18*f4a2713aSLionel Sambuc testM_Packed(void)19*f4a2713aSLionel Sambucint testM_Packed (void) { 20*f4a2713aSLionel Sambuc struct M_Packed x; 21*f4a2713aSLionel Sambuc return (0 != x.Y); 22*f4a2713aSLionel Sambuc } 23*f4a2713aSLionel Sambuc testM_Packed2(void)24*f4a2713aSLionel Sambucint testM_Packed2 (void) { 25*f4a2713aSLionel Sambuc struct M_Packed x; 26*f4a2713aSLionel Sambuc return (0 != x.X); 27*f4a2713aSLionel Sambuc } 28