Check first member alignment and uses packed struct if required.

llvm-svn: 51619
This commit is contained in:
Devang Patel 2008-05-27 22:45:40 +00:00
parent d608074e09
commit 1c56ace4df
2 changed files with 5 additions and 0 deletions

View File

@ -516,6 +516,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) {
unsigned Align = CGT.getTargetData().getABITypeAlignment(Ty) * 8;
if (llvmSize % Align)
packedStruct = true;
else if (offset == 0 && RL.getAlignment() % Align)
packedStruct = true;
llvmSize += size;
CGT.addFieldInfo(FD, LLVMFields.size());

View File

@ -160,3 +160,6 @@ int f14(int i, ...) {
a13 b = __builtin_va_arg(l, a13);
return b.b;
}
/* Attribute packed */
struct __attribute__((packed)) S2839 { double a[19]; signed char b; } s2839[5];