[cfe-commits] r51619 - in /cfe/trunk: lib/CodeGen/CodeGenTypes.cpp test/CodeGen/struct.c
Devang Patel
dpatel at apple.com
Tue May 27 15:45:40 PDT 2008
Author: dpatel
Date: Tue May 27 17:45:40 2008
New Revision: 51619
URL: http://llvm.org/viewvc/llvm-project?rev=51619&view=rev
Log:
Check first member alignment and uses packed struct if required.
Modified:
cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
cfe/trunk/test/CodeGen/struct.c
Modified: cfe/trunk/lib/CodeGen/CodeGenTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTypes.cpp?rev=51619&r1=51618&r2=51619&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTypes.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTypes.cpp Tue May 27 17:45:40 2008
@@ -516,6 +516,8 @@
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());
Modified: cfe/trunk/test/CodeGen/struct.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/struct.c?rev=51619&r1=51618&r2=51619&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/struct.c (original)
+++ cfe/trunk/test/CodeGen/struct.c Tue May 27 17:45:40 2008
@@ -160,3 +160,6 @@
a13 b = __builtin_va_arg(l, a13);
return b.b;
}
+
+/* Attribute packed */
+struct __attribute__((packed)) S2839 { double a[19]; signed char b; } s2839[5];
More information about the cfe-commits
mailing list