1335552e3fff9f41067cccfd72557f801d398949aEric Christopher// RUN: %clang_cc1 -emit-llvm %s -o - 2335552e3fff9f41067cccfd72557f801d398949aEric Christopher 3335552e3fff9f41067cccfd72557f801d398949aEric Christopher 4335552e3fff9f41067cccfd72557f801d398949aEric Christopher#ifdef PACKED 5335552e3fff9f41067cccfd72557f801d398949aEric Christopher// This is an example where size of Packed struct is smaller then 6335552e3fff9f41067cccfd72557f801d398949aEric Christopher// the size of bit field type. 7335552e3fff9f41067cccfd72557f801d398949aEric Christopher#define P __attribute__((packed)) 8335552e3fff9f41067cccfd72557f801d398949aEric Christopher#else 9335552e3fff9f41067cccfd72557f801d398949aEric Christopher#define P 10335552e3fff9f41067cccfd72557f801d398949aEric Christopher#endif 11335552e3fff9f41067cccfd72557f801d398949aEric Christopher 12335552e3fff9f41067cccfd72557f801d398949aEric Christopherstruct P M_Packed { 13335552e3fff9f41067cccfd72557f801d398949aEric Christopher unsigned long long X:50; 14335552e3fff9f41067cccfd72557f801d398949aEric Christopher unsigned Y:2; 15335552e3fff9f41067cccfd72557f801d398949aEric Christopher}; 16335552e3fff9f41067cccfd72557f801d398949aEric Christopher 17335552e3fff9f41067cccfd72557f801d398949aEric Christopherstruct M_Packed sM_Packed; 18335552e3fff9f41067cccfd72557f801d398949aEric Christopher 19335552e3fff9f41067cccfd72557f801d398949aEric Christopherint testM_Packed (void) { 20335552e3fff9f41067cccfd72557f801d398949aEric Christopher struct M_Packed x; 21335552e3fff9f41067cccfd72557f801d398949aEric Christopher return (0 != x.Y); 22335552e3fff9f41067cccfd72557f801d398949aEric Christopher} 23335552e3fff9f41067cccfd72557f801d398949aEric Christopher 24335552e3fff9f41067cccfd72557f801d398949aEric Christopherint testM_Packed2 (void) { 25335552e3fff9f41067cccfd72557f801d398949aEric Christopher struct M_Packed x; 26335552e3fff9f41067cccfd72557f801d398949aEric Christopher return (0 != x.X); 27335552e3fff9f41067cccfd72557f801d398949aEric Christopher} 28