[llvm-commits] [llvm-gcc-4.2] r48930 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Devang Patel
dpatel at apple.com
Fri Mar 28 16:01:31 PDT 2008
Author: dpatel
Date: Fri Mar 28 18:01:31 2008
New Revision: 48930
URL: http://llvm.org/viewvc/llvm-project?rev=48930&view=rev
Log:
If bit-field has user defined alignment and it does not match Ty alignment then convert to a packed struct and try again.
This fixes test couple of gcc dejagnu struct-layout-1.exp test fauilures
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=48930&r1=48929&r2=48930&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Mar 28 18:01:31 2008
@@ -1770,6 +1770,13 @@
// before this field.
if (DECL_PACKED(Field))
return false;
+ // If Field has user defined alignment and it does not match Ty alignment
+ // then convert to a packed struct and try again.
+ if (TYPE_USER_ALIGN(DECL_BIT_FIELD_TYPE(Field))) {
+ const Type *Ty = ConvertType(getDeclaredType(Field));
+ if (TYPE_ALIGN_UNIT(DECL_BIT_FIELD_TYPE(Field)) != Info.getTypeAlignment(Ty))
+ return false;
+ }
}
DecodeStructBitField(Field, Info);
return true;
More information about the llvm-commits
mailing list