summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compat/struct-align-1.h
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.dg/compat/struct-align-1.h
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.dg/compat/struct-align-1.h')
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-align-1.h180
1 files changed, 180 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-1.h b/gcc/testsuite/gcc.dg/compat/struct-align-1.h
new file mode 100644
index 000000000..d9006c741
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-align-1.h
@@ -0,0 +1,180 @@
+/* Define several variants of a struct for which the alignment differs
+ between powerpc64-linux and powerpc64-aix. This might be interesting
+ for other targets as well. */
+
+#define DESC_orig "original"
+struct B1_orig {
+ char c;
+ double d;
+};
+
+struct A2_orig {
+ double d;
+};
+
+struct B2_orig {
+ char c;
+ struct A2_orig a2;
+};
+
+struct A3_orig {
+ double d;
+ int i;
+};
+
+struct B3_orig {
+ char c;
+ struct A3_orig a3;
+};
+
+#ifndef SKIP_ATTRIBUTE
+#define DESC_p_all "packed attribute for all"
+struct B1_p_all {
+ char c;
+ double d;
+} __attribute__ ((packed));
+
+struct A2_p_all {
+ double d;
+} __attribute__ ((packed));
+
+struct B2_p_all {
+ char c;
+ struct A2_p_all a2;
+} __attribute__ ((packed));
+
+struct A3_p_all {
+ double d;
+ int i;
+} __attribute__ ((packed));
+
+struct B3_p_all {
+ char c;
+ struct A3_p_all a3;
+} __attribute__ ((packed));
+
+#define DESC_p_inner "packed attribute for inner"
+struct B1_p_inner {
+ char c;
+ double d;
+};
+
+struct A2_p_inner {
+ double d;
+} __attribute__ ((packed));
+
+struct B2_p_inner {
+ char c;
+ struct A2_p_inner a2;
+};
+
+struct A3_p_inner {
+ double d;
+ int i;
+} __attribute__ ((packed));
+
+struct B3_p_inner {
+ char c;
+ struct A3_p_inner a3;
+};
+
+#define DESC_p_outer "packed attribute for outer"
+struct B1_p_outer {
+ char c;
+ double d;
+} __attribute__ ((packed));
+
+struct A2_p_outer {
+ double d;
+};
+
+struct B2_p_outer {
+ char c;
+ struct A2_p_outer a2;
+} __attribute__ ((packed));
+
+struct A3_p_outer {
+ double d;
+ int i;
+};
+
+struct B3_p_outer {
+ char c;
+ struct A3_p_outer a3;
+} __attribute__ ((packed));
+
+#define DESC_a_max "maximum useful struct alignment for all"
+struct B1_a_max {
+ char c;
+ double d;
+} __attribute__ ((aligned));
+
+struct A2_a_max {
+ double d;
+} __attribute__ ((aligned));
+
+struct B2_a_max {
+ char c;
+ struct A2_a_max a2;
+} __attribute__ ((aligned));
+
+struct A3_a_max {
+ double d;
+ int i;
+} __attribute__ ((aligned));
+
+struct B3_a_max {
+ char c;
+ struct A3_a_max a3;
+} __attribute__ ((aligned));
+
+#define DESC_m_outer_p_inner "maximum alignment for outer, packed inner"
+struct B1_m_outer_p_inner {
+ char c;
+ double d;
+} __attribute__ ((aligned)) __attribute__ ((packed));
+
+struct A2_m_outer_p_inner {
+ double d;
+} __attribute__ ((packed));
+
+struct B2_m_outer_p_inner {
+ char c;
+ struct A2_m_outer_p_inner a2;
+} __attribute__ ((aligned));
+
+struct A3_m_outer_p_inner {
+ double d;
+ int i;
+} __attribute__ ((packed));
+
+struct B3_m_outer_p_inner {
+ char c;
+ struct A3_m_outer_p_inner a3;
+} __attribute__ ((aligned));
+
+#define DESC_m_inner_p_outer "maximum alignment for inner, packed outer"
+struct B1_m_inner_p_outer {
+ char c;
+ double d;
+} __attribute__ ((aligned)) __attribute__ ((packed));
+
+struct A2_m_inner_p_outer {
+ double d;
+} __attribute__ ((aligned));
+
+struct B2_m_inner_p_outer {
+ char c;
+ struct A2_m_inner_p_outer a2;
+} __attribute__ ((packed));
+
+struct A3_m_inner_p_outer {
+ double d;
+ int i;
+} __attribute__ ((aligned));
+
+struct B3_m_inner_p_outer {
+ char c;
+ struct A3_m_inner_p_outer a3;
+} __attribute__ ((packed));
+#endif