Check first member alignment and uses packed struct if required.
llvm-svn: 51619
This commit is contained in:
parent
d608074e09
commit
1c56ace4df
|
@ -516,6 +516,8 @@ void RecordOrganizer::layoutStructFields(const ASTRecordLayout &RL) {
|
||||||
unsigned Align = CGT.getTargetData().getABITypeAlignment(Ty) * 8;
|
unsigned Align = CGT.getTargetData().getABITypeAlignment(Ty) * 8;
|
||||||
if (llvmSize % Align)
|
if (llvmSize % Align)
|
||||||
packedStruct = true;
|
packedStruct = true;
|
||||||
|
else if (offset == 0 && RL.getAlignment() % Align)
|
||||||
|
packedStruct = true;
|
||||||
|
|
||||||
llvmSize += size;
|
llvmSize += size;
|
||||||
CGT.addFieldInfo(FD, LLVMFields.size());
|
CGT.addFieldInfo(FD, LLVMFields.size());
|
||||||
|
|
|
@ -160,3 +160,6 @@ int f14(int i, ...) {
|
||||||
a13 b = __builtin_va_arg(l, a13);
|
a13 b = __builtin_va_arg(l, a13);
|
||||||
return b.b;
|
return b.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Attribute packed */
|
||||||
|
struct __attribute__((packed)) S2839 { double a[19]; signed char b; } s2839[5];
|
||||||
|
|
Loading…
Reference in New Issue