[cfe-commits] r64947 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/Sema/struct-packed-align.c

Daniel Dunbar daniel at zuster.org
Wed Feb 18 12:06:10 PST 2009


Author: ddunbar
Date: Wed Feb 18 14:06:09 2009
New Revision: 64947

URL: http://llvm.org/viewvc/llvm-project?rev=64947&view=rev
Log:
__attribute__((aligned)) was being ignored!

This knocks out another 8 gcc/compat/i386 & x86_64 failures.

Modified:
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/Sema/struct-packed-align.c

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=64947&r1=64946&r2=64947&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Feb 18 14:06:09 2009
@@ -1177,8 +1177,9 @@
   unsigned Align = 0;
   if (Attr.getNumArgs() == 0) {
     // FIXME: This should be the target specific maximum alignment.
-    // (For now we just use 128 bits which is the maximum on X86.
+    // (For now we just use 128 bits which is the maximum on X86).
     Align = 128;
+    d->addAttr(new AlignedAttr(Align));
     return;
   }
   

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=64947&r1=64946&r2=64947&view=diff

==============================================================================
--- cfe/trunk/test/Sema/struct-packed-align.c (original)
+++ cfe/trunk/test/Sema/struct-packed-align.c Wed Feb 18 14:06:09 2009
@@ -46,6 +46,14 @@
 extern int e1[sizeof(struct as1) == 8 ? 1 : -1];
 extern int e2[__alignof(struct as1) == 8 ? 1 : -1];
 
+// FIXME: Will need to force arch once max usable alignment isn't hard
+// coded.
+struct __attribute__((aligned)) as1_2 {
+    char c;
+};
+extern int e1_2[sizeof(struct as1_2) == 16 ? 1 : -1];
+extern int e2_2[__alignof(struct as1_2) == 16 ? 1 : -1];
+
 struct as2 {
     char c;
     int __attribute__((aligned(8))) a;





More information about the cfe-commits mailing list