diff options
author | Chris Lattner <sabre@nondot.org> | 2008-05-09 05:34:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-05-09 05:34:49 +0000 |
commit | abb575866059c9bb74fe4aa32372f002143fa87c (patch) | |
tree | 298ec9aabaa2246588b2c894448c9107c20d9e41 | |
parent | 039a64212713aebdcc196ea41135c2af4f4386dc (diff) |
Fix rdar://5921025 a crash on the included testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50885 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 3 | ||||
-rw-r--r-- | test/Sema/struct-packed-align.c | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 373727a5d8..9a7d692c97 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2183,7 +2183,8 @@ void Sema::HandlePackedAttribute(Decl *d, AttributeList *rawAttr) { else if (FieldDecl *FD = dyn_cast<FieldDecl>(d)) { // If the alignment is less than or equal to 8 bits, the packed attribute // has no effect. - if (Context.getTypeAlign(FD->getType()) <= 8) + if (!FD->getType()->isIncompleteType() && + Context.getTypeAlign(FD->getType()) <= 8) Diag(rawAttr->getLoc(), diag::warn_attribute_ignored_for_field_of_type, rawAttr->getName()->getName(), FD->getType().getAsString()); diff --git a/test/Sema/struct-packed-align.c b/test/Sema/struct-packed-align.c index f718343563..f759e37a1d 100644 --- a/test/Sema/struct-packed-align.c +++ b/test/Sema/struct-packed-align.c @@ -62,3 +62,10 @@ struct __attribute__((packed)) as3 { extern int g1[sizeof(struct as3) == 16 ? 1 : -1]; extern int g2[__alignof(struct as3) == 8 ? 1 : -1]; + + +// rdar://5921025 +struct packedtest { + int ted_likes_cheese; + void *args[] __attribute__((packed)); +}; |