summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c
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_x.c
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_x.c')
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-align-1_x.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c b/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c
new file mode 100644
index 000000000..939db9d21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c
@@ -0,0 +1,110 @@
+/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+#include "compat-common.h"
+#include "struct-align-1.h"
+
+#define SETUP(NAME,V1,V2,V3) \
+char v1_##NAME = V1; \
+double v2_##NAME = V2; \
+int v3_##NAME = V3; \
+ \
+struct B1_##NAME b1_##NAME = { V1, V2 }; \
+struct B2_##NAME b2_##NAME = { V1, { V2 } }; \
+struct B3_##NAME b3_##NAME = { V1, { V2, V3 } }; \
+ \
+struct B1_##NAME ab1_##NAME[2] = \
+ { { V1, V2 }, { V1, V2 } }; \
+struct B2_##NAME ab2_##NAME[2] = \
+ { { V1, { V2 } }, { V1, { V2 } } }; \
+struct B3_##NAME ab3_##NAME[2] = \
+ { { V1, { V2, V3 } }, { V1, { V2, V3 } } }; \
+ \
+extern void test_##NAME (void); \
+extern void checkp1_##NAME (struct B1_##NAME *); \
+extern void checkp2_##NAME (struct B2_##NAME *); \
+extern void checkp3_##NAME (struct B3_##NAME *); \
+extern void checkg1_##NAME (void); \
+extern void checkg2_##NAME (void); \
+extern void checkg3_##NAME (void); \
+ \
+void \
+pass1_##NAME (struct B1_##NAME s) \
+{ \
+ checkp1_##NAME (&s); \
+} \
+ \
+void \
+pass2_##NAME (struct B2_##NAME s) \
+{ \
+ checkp2_##NAME (&s); \
+} \
+ \
+void \
+pass3_##NAME (struct B3_##NAME s) \
+{ \
+ checkp3_##NAME (&s); \
+} \
+ \
+struct B1_##NAME \
+return1_##NAME (void) \
+{ \
+ return ab1_##NAME[0]; \
+} \
+ \
+struct B2_##NAME \
+return2_##NAME (void) \
+{ \
+ return ab2_##NAME[0]; \
+} \
+ \
+struct B3_##NAME \
+return3_##NAME (void) \
+{ \
+ return ab3_##NAME[0]; \
+}
+
+#define CHECK(NAME) test_##NAME()
+
+#if __INT_MAX__ > 32767
+SETUP (orig, 49, 1.0, 111111)
+#else
+SETUP (orig, 49, 1.0, 1111)
+#endif
+#ifndef SKIP_ATTRIBUTE
+#if __INT_MAX__ > 32767
+SETUP (p_all, 50, 2.0, 222222)
+SETUP (p_inner, 51, 3.0, 333333)
+SETUP (p_outer, 52, 4.0, 444444)
+SETUP (a_max, 53, 5.0, 555555)
+SETUP (m_outer_p_inner, 54, 6.0, 666666)
+SETUP (m_inner_p_outer, 55, 7.0, 777777)
+#else
+SETUP (p_all, 50, 2.0, 2222)
+SETUP (p_inner, 51, 3.0, 3333)
+SETUP (p_outer, 52, 4.0, 4444)
+SETUP (a_max, 53, 5.0, 5555)
+SETUP (m_outer_p_inner, 54, 6.0, 6666)
+SETUP (m_inner_p_outer, 55, 7.0, 7777)
+#endif
+#endif
+
+void
+struct_align_1_x (void)
+{
+ DEBUG_INIT
+
+ CHECK (orig);
+#ifndef SKIP_ATTRIBUTE
+ CHECK (p_all);
+ CHECK (p_inner);
+ CHECK (p_outer);
+ CHECK (a_max);
+ CHECK (m_outer_p_inner);
+ CHECK (m_inner_p_outer);
+#endif
+
+ DEBUG_FINI
+
+ if (fails != 0)
+ abort ();
+}