[cfe-commits] r50885 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/struct-packed-align.c
Chris Lattner
sabre at nondot.org
Thu May 8 22:34:49 PDT 2008
Author: lattner
Date: Fri May 9 00:34:49 2008
New Revision: 50885
URL: http://llvm.org/viewvc/llvm-project?rev=50885&view=rev
Log:
Fix rdar://5921025 a crash on the included testcase.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/struct-packed-align.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=50885&r1=50884&r2=50885&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri May 9 00:34:49 2008
@@ -2183,7 +2183,8 @@
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());
Modified: cfe/trunk/test/Sema/struct-packed-align.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/struct-packed-align.c?rev=50885&r1=50884&r2=50885&view=diff
==============================================================================
--- cfe/trunk/test/Sema/struct-packed-align.c (original)
+++ cfe/trunk/test/Sema/struct-packed-align.c Fri May 9 00:34:49 2008
@@ -62,3 +62,10 @@
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));
+};
More information about the cfe-commits
mailing list