]> granicus.if.org Git - clang/commitdiff
Fix rdar://5921025 a crash on the included testcase.
authorChris Lattner <sabre@nondot.org>
Fri, 9 May 2008 05:34:49 +0000 (05:34 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 9 May 2008 05:34:49 +0000 (05:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50885 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/Sema/struct-packed-align.c

index 373727a5d8e79a75559169b215cb6a75fda39b10..9a7d692c9754cc6b390e6f791658f897308b24b5 100644 (file)
@@ -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());
index f7183435639e667cb7f5c538e5db568d95d89107..f759e37a1df54171bf6c51272877bd76a5343add 100644 (file)
@@ -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));
+};