summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compat/struct-align-2_y.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-2_y.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-2_y.c')
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-align-2_y.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c b/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c
new file mode 100644
index 000000000..2727015a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c
@@ -0,0 +1,75 @@
+/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+/* Disable this test for 16-bit targets. */
+
+#include <limits.h>
+
+#if !(defined __GNUC__) || (INT_MAX > 32767)
+
+#include "compat-common.h"
+#include "struct-align-2.h"
+
+#define TEST(NAME) \
+struct outer_##NAME { \
+ int i; \
+ struct epoll_event_##NAME ee; \
+}; \
+ \
+extern unsigned int v1_##NAME; \
+extern unsigned int v2_##NAME; \
+extern unsigned long long v3_##NAME; \
+ \
+extern struct outer_##NAME s_##NAME[2]; \
+ \
+extern void pass_##NAME (struct outer_##NAME); \
+extern struct outer_##NAME return_##NAME (void); \
+ \
+void \
+checkp_##NAME (struct outer_##NAME *p) \
+{ \
+ if (p->i != v1_##NAME) \
+ DEBUG_CHECK; \
+ if (p->ee.events != v2_##NAME) \
+ DEBUG_CHECK; \
+ if (p->ee.data != v3_##NAME) \
+ DEBUG_CHECK; \
+} \
+ \
+void \
+test_##NAME (void) \
+{ \
+ struct outer_##NAME s; \
+ DEBUG_FPUTS (DESC_##NAME); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (" global array"); \
+ checkp_##NAME (&s_##NAME[0]); \
+ checkp_##NAME (&s_##NAME[1]); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (" argument"); \
+ pass_##NAME (s_##NAME[0]); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (" function result"); \
+ s = return_##NAME (); \
+ checkp_##NAME (&s); \
+ DEBUG_NL; \
+}
+
+TEST (orig)
+#ifndef SKIP_ATTRIBUTE
+TEST (structmax)
+TEST (struct4)
+TEST (struct8)
+TEST (data4)
+TEST (data8)
+TEST (p)
+TEST (pstruct4)
+TEST (pstruct8)
+TEST (pdata4)
+TEST (pdata8)
+#endif
+
+#else
+
+int i; /* prevent compiling an empty file */
+
+#endif /* INT_MAX */