diff options
author | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2008-02-08 19:46:46 +0000 |
---|---|---|
committer | Lauro Ramos Venancio <lauro.venancio@gmail.com> | 2008-02-08 19:46:46 +0000 |
commit | c0959fc20d40fbe0c44a88eb1d7fc9395a163840 (patch) | |
tree | faf4ba53dcea869bdad58b4fb02a65797fe3f10a | |
parent | b87d9096d0bbce83fd5f79f2346dc49d1046e092 (diff) |
Fix a bitfield regression. Reported by Anders Carlsson.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46889 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | CodeGen/CodeGenTypes.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/2008-02-08-bitfield-bug.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/CodeGen/CodeGenTypes.cpp b/CodeGen/CodeGenTypes.cpp index bed01eeb61..d293b4f081 100644 --- a/CodeGen/CodeGenTypes.cpp +++ b/CodeGen/CodeGenTypes.cpp @@ -573,5 +573,6 @@ void RecordOrganizer::placeBitField(const FieldDecl *FD) { CGT.addBitFieldInfo(FD, 0, BitFieldSize); Cursor = (Idx + 1) * TySize + BitFieldSize; } - addPaddingFields(Cursor); + if (Cursor > llvmSize) + addPaddingFields(Cursor); } diff --git a/test/CodeGen/2008-02-08-bitfield-bug.c b/test/CodeGen/2008-02-08-bitfield-bug.c new file mode 100644 index 0000000000..1a9c266fe7 --- /dev/null +++ b/test/CodeGen/2008-02-08-bitfield-bug.c @@ -0,0 +1,9 @@ +// RUN: clang %s -emit-llvm + +struct test { + unsigned a:1; + unsigned b:1; +}; + +struct test *t; + |