Correct a thinko in bitfield layout code. Fixes PR4611.

llvm-svn: 76898
This commit is contained in:
Anders Carlsson 2009-07-23 21:16:33 +00:00
parent 2a5b83c7e6
commit 516e5e7835
2 changed files with 8 additions and 4 deletions

View File

@ -88,10 +88,8 @@ void CGRecordLayoutBuilder::LayoutBitField(const FieldDecl *D,
AppendBytes(NumBytesToAppend);
if (!NumBytesToAppend)
BitsAvailableInLastField -= FieldSize;
else
BitsAvailableInLastField = NumBytesToAppend * 8 - FieldSize;
BitsAvailableInLastField =
getNextFieldOffsetInBytes() * 8 - (FieldOffset + FieldSize);
}
bool CGRecordLayoutBuilder::LayoutField(const FieldDecl *D,

View File

@ -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;