re PR c/11446 ([3.4][3.4 regression?] Incompatibilty with alignment of structures...
authorJason Merrill <jason@gcc.gnu.org>
Mon, 20 Oct 2003 22:01:58 +0000 (18:01 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 20 Oct 2003 22:01:58 +0000 (18:01 -0400)
        PR c/11446
        * stor-layout.c (layout_decl): Fix alignment handling.

From-SVN: r72725

gcc/testsuite/gcc.dg/pack-test-5.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/pack-test-5.c b/gcc/testsuite/gcc.dg/pack-test-5.c
new file mode 100644 (file)
index 0000000..e95030c
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR c/11446: packed on a struct takes precedence over aligned on the type
+   of a field.  */
+/* { dg-do run } */
+
+struct A {
+  double d;
+} __attribute__ ((aligned));
+
+struct B {
+  char c;
+  struct A a;
+} __attribute__ ((packed));
+
+int main ()
+{
+  if (sizeof (struct B) != sizeof (char) + sizeof (struct A))
+    abort ();
+  return 0;
+}