[llvm-commits] [llvm-gcc-4.2] r48883 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Devang Patel
dpatel at apple.com
Thu Mar 27 10:14:51 PDT 2008
Author: dpatel
Date: Thu Mar 27 12:14:50 2008
New Revision: 48883
URL: http://llvm.org/viewvc/llvm-project?rev=48883&view=rev
Log:
Redo entire struct layout when packed field is seen as part of non-packed struct.
(This time handle non-bitfields)
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=48883&r1=48882&r2=48883&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Mar 27 12:14:50 2008
@@ -1784,10 +1784,14 @@
const Type *Ty = ConvertType(getDeclaredType(Field));
+ // If this field is packed then the struct may need padding fields
+ // before this field.
+ if (DECL_PACKED(Field) && !Info.isPacked())
+ return false;
// Pop any previous elements out of the struct if they overlap with this one.
// This can happen when the C++ front-end overlaps fields with tail padding in
// C++ classes.
- if (!Info.ResizeLastElementIfOverlapsWith(StartOffsetInBytes, Field, Ty)) {
+ else if (!Info.ResizeLastElementIfOverlapsWith(StartOffsetInBytes, Field, Ty)) {
// LLVM disagrees as to where this field should go in the natural field
// ordering. Therefore convert to a packed struct and try again.
return false;
More information about the llvm-commits
mailing list