diff options
| author | Yunzhong Gao <Yunzhong_Gao@playstation.sony.com> | 2014-02-13 02:45:10 +0000 |
|---|---|---|
| committer | Yunzhong Gao <Yunzhong_Gao@playstation.sony.com> | 2014-02-13 02:45:10 +0000 |
| commit | 5fd0c9d032bda1a3a8ab134ec13e6ece1c023772 (patch) | |
| tree | 84d4912870b7da43296c1d67f621b7ed728ebf64 /clang/lib | |
| parent | 4f345f3c03e648145794e754aacaf1093f1ce3b6 (diff) | |
| download | bcm5719-llvm-5fd0c9d032bda1a3a8ab134ec13e6ece1c023772.tar.gz bcm5719-llvm-5fd0c9d032bda1a3a8ab134ec13e6ece1c023772.zip | |
Fixing a compiler assertion with zero-width bit-fields in packed structs.
According to the GNU docs, zero-sized bitfields should not be affected by the
packed attribute.
Differential Revision: http://llvm-reviews.chandlerc.com/D2693
llvm-svn: 201288
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/RecordLayoutBuilder.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/AST/RecordLayoutBuilder.cpp b/clang/lib/AST/RecordLayoutBuilder.cpp index cffdcaf743b..139ee60ef80 100644 --- a/clang/lib/AST/RecordLayoutBuilder.cpp +++ b/clang/lib/AST/RecordLayoutBuilder.cpp @@ -1552,8 +1552,8 @@ void RecordLayoutBuilder::LayoutBitField(const FieldDecl *D) { // Remember the alignment we would have used if the field were not packed. unsigned UnpackedFieldAlign = FieldAlign; - // Ignore the field alignment if the field is packed. - if (!IsMsStruct && FieldPacked) + // Ignore the field alignment if the field is packed unless it has zero-size. + if (!IsMsStruct && FieldPacked && FieldSize != 0) FieldAlign = 1; // But, if there's an 'aligned' attribute on the field, honor that. |

