[llvm-commits] [llvm-gcc-4.2] r53570 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Bill Wendling
isanbard at gmail.com
Mon Jul 14 11:37:30 PDT 2008
Author: void
Date: Mon Jul 14 13:37:29 2008
New Revision: 53570
URL: http://llvm.org/viewvc/llvm-project?rev=53570&view=rev
Log:
Fix how the alignment for bitfields is calculated. For instance, in this situation:
typedef unsigned long NSUInteger;
@interface NSData
{
int x;
}
- (NSUInteger)length;
@end
@interface NSConcreteData : NSData
{
unsigned int _inline:1;
}
@end
We were generating:
L_OBJC_$_INSTANCE_VARIABLES_NSConcreteData: ## L_OBJC_$_INSTANCE_VARIABLES_NSConcreteData
.long 32 ## 0x20
.long 1 ## 0x1
.quad _OBJC_IVAR_$_NSConcreteData._inline
.quad L_OBJC_METH_VAR_NAME_0
.quad L_OBJC_METH_VAR_TYPE_0
.space 4
.long 1 ## 0x1
the ".space 4" should be ".long 2"
Modified:
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=53570&r1=53569&r2=53570&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Mon Jul 14 13:37:29 2008
@@ -10617,7 +10617,10 @@
/* Set alignment */
/* APPLE LOCAL radar 5724385 */
- val = TYPE_ALIGN_UNIT (TREE_TYPE (field_decl));
+ val = TYPE_ALIGN_UNIT (
+ DECL_BIT_FIELD_TYPE (field_decl) ? DECL_BIT_FIELD_TYPE (field_decl) :
+ TREE_TYPE (field_decl));
+ /* APPLE LOCAL end radar 5724385 */
val = exact_log2 (val);
ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, val), ivar);
More information about the llvm-commits
mailing list