aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/pack-test-5.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pack-test-5.c b/gcc/testsuite/gcc.dg/pack-test-5.c
new file mode 100644
index 0000000..e95030c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pack-test-5.c
@@ -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;
+}