]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/45112 (Aligned attribute on static class member definition ignored)
authorUlrich Weigand <uweigand@de.ibm.com>
Fri, 30 Jul 2010 15:49:34 +0000 (15:49 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Fri, 30 Jul 2010 15:49:34 +0000 (15:49 +0000)
gcc/
PR c++/45112
* cp/decl.c (duplicate_decls): Merge DECL_USER_ALIGN and DECL_PACKED.

gcc/testsuite/
PR c++/45112
* testsuite/g++.dg/pr45112.C: New test.

From-SVN: r162716

gcc/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr45112.C [new file with mode: 0644]

index c94bf560a4a8e3315d2673f43879ed1ccaccbfad..faa152206b5466d6f86cd7014ecbc39c789bbe5d 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-30  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       PR c++/45112
+       * cp/decl.c (duplicate_decls): Merge DECL_USER_ALIGN and DECL_PACKED.
+
 2010-07-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/45055
index 3aaa20c0ed3823d778cdbcfead1f7b33b2031744..4e4a27786b8089a09d82a58649384076c3aa2672 100644 (file)
@@ -2113,6 +2113,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
       SET_DECL_INIT_PRIORITY (olddecl, DECL_INIT_PRIORITY (newdecl));
       DECL_HAS_INIT_PRIORITY_P (olddecl) = 1;
     }
+  /* Likewise for DECL_USER_ALIGN and DECL_PACKED.  */
+  DECL_USER_ALIGN (olddecl) = DECL_USER_ALIGN (newdecl);
+  if (TREE_CODE (newdecl) == FIELD_DECL)
+    DECL_PACKED (olddecl) = DECL_PACKED (newdecl);
 
   /* The DECL_LANG_SPECIFIC information in OLDDECL will be replaced
      with that from NEWDECL below.  */
index 2fded2a5233b5d712e545924c2e3622b09910e72..132433051e58f24bd75936bdd169d335f7b8b990 100644 (file)
@@ -1,3 +1,8 @@
+2010-07-30  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       PR c++/45112
+       * testsuite/g++.dg/pr45112.C: New test.
+
 2010-07-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/45055
diff --git a/gcc/testsuite/g++.dg/pr45112.C b/gcc/testsuite/g++.dg/pr45112.C
new file mode 100644 (file)
index 0000000..34dd3e1
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+struct JSString
+{
+  unsigned char mLength;
+  static JSString unitStringTable[];
+};
+
+JSString JSString::unitStringTable[] __attribute__ ((aligned (8))) = { 1 };
+
+int bug [__alignof__ (JSString::unitStringTable) >= 8 ? 1 : -1];
+