[cfe-commits] r76898 - in /cfe/trunk: lib/CodeGen/CGRecordLayoutBuilder.cpp test/CodeGen/PR4611-bitfield-layout.c
Anders Carlsson
andersca at mac.com
Thu Jul 23 14:17:29 PDT 2009
Author: andersca
Date: Thu Jul 23 16:16:33 2009
New Revision: 76898
URL: http://llvm.org/viewvc/llvm-project?rev=76898&view=rev
Log:
Correct a thinko in bitfield layout code. Fixes PR4611.
Added:
cfe/trunk/test/CodeGen/PR4611-bitfield-layout.c
Modified:
cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
Modified: cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp?rev=76898&r1=76897&r2=76898&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRecordLayoutBuilder.cpp Thu Jul 23 16:16:33 2009
@@ -88,10 +88,8 @@
AppendBytes(NumBytesToAppend);
- if (!NumBytesToAppend)
- BitsAvailableInLastField -= FieldSize;
- else
- BitsAvailableInLastField = NumBytesToAppend * 8 - FieldSize;
+ BitsAvailableInLastField =
+ getNextFieldOffsetInBytes() * 8 - (FieldOffset + FieldSize);
}
bool CGRecordLayoutBuilder::LayoutField(const FieldDecl *D,
Added: cfe/trunk/test/CodeGen/PR4611-bitfield-layout.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/PR4611-bitfield-layout.c?rev=76898&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/PR4611-bitfield-layout.c (added)
+++ cfe/trunk/test/CodeGen/PR4611-bitfield-layout.c Thu Jul 23 16:16:33 2009
@@ -0,0 +1,6 @@
+// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o %t &&
+// RUN: grep "struct.object_entry = type <{ i8, i8, i8, i8 }>" %t
+
+struct object_entry {
+ unsigned int type:3, pack_id:16, depth:13;
+} entries;
More information about the cfe-commits
mailing list