aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanis Johnson <janis187@us.ibm.com>2003-05-21 23:14:22 +0000
committerJanis Johnson <janis@gcc.gnu.org>2003-05-21 23:14:22 +0000
commit9008d5b47e4efee754b14d5587a61fd9e61b10b1 (patch)
treed76d916f25bfd67bb95a3a4a1536fa989572ba35
parent81888fcd42973009ff47f73f6b7fd8a56809f416 (diff)
downloadgcc-9008d5b47e4efee754b14d5587a61fd9e61b10b1.zip
gcc-9008d5b47e4efee754b14d5587a61fd9e61b10b1.tar.gz
gcc-9008d5b47e4efee754b14d5587a61fd9e61b10b1.tar.bz2
scalar-return-1_main.c: New file.
2003-05-21 Janis Johnson <janis187@us.ibm.com> * gcc.dg/compat/scalar-return-1_main.c: New file. * gcc.dg/compat/scalar-return-1_x.c: New file. * gcc.dg/compat/scalar-return-1_y.c: New file. * gcc.dg/compat/scalar-return-2_main.c: New file. * gcc.dg/compat/scalar-return-2_x.c: New file. * gcc.dg/compat/scalar-return-2_y.c: New file. * gcc.dg/compat/struct-return-3_main.c: New file. * gcc.dg/compat/struct-return-3_y.c: New file. * gcc.dg/compat/struct-return-3_x.c: New file. * gcc.dg/compat/struct-return-2_main.c: New file. * gcc.dg/compat/struct-return-2_x.c: New file. * gcc.dg/compat/struct-return-2_y.c: New file. (I thought I had committed these yesterday) From-SVN: r67070
-rw-r--r--gcc/testsuite/ChangeLog28
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c110
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c94
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c88
-rw-r--r--gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c73
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-2_main.c12
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-2_x.c205
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-2_y.c142
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-3_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-3_x.c122
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-3_y.c98
13 files changed, 996 insertions, 13 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0184524..c3b456e 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,18 @@
+2003-05-21 Janis Johnson <janis187@us.ibm.com>
+
+ * gcc.dg/compat/scalar-return-1_main.c: New file.
+ * gcc.dg/compat/scalar-return-1_x.c: New file.
+ * gcc.dg/compat/scalar-return-1_y.c: New file.
+ * gcc.dg/compat/scalar-return-2_main.c: New file.
+ * gcc.dg/compat/scalar-return-2_x.c: New file.
+ * gcc.dg/compat/scalar-return-2_y.c: New file.
+ * gcc.dg/compat/struct-return-3_main.c: New file.
+ * gcc.dg/compat/struct-return-3_y.c: New file.
+ * gcc.dg/compat/struct-return-3_x.c: New file.
+ * gcc.dg/compat/struct-return-2_main.c: New file.
+ * gcc.dg/compat/struct-return-2_x.c: New file.
+ * gcc.dg/compat/struct-return-2_y.c: New file.
+
2003-05-21 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* g++.old-deja/g++.law/profile1.C (dg-options): Add -static to options
@@ -30,19 +45,6 @@
* gcc.dg/compat/fp-struct-test-by-value-y.h: New file.
* gcc.dg/compat/fp-struct-test-by-value-x.h: New file.
- * gcc.dg/compat/scalar-return-1_main.c: New file.
- * gcc.dg/compat/scalar-return-1_x.c: New file.
- * gcc.dg/compat/scalar-return-1_y.c: New file.
- * gcc.dg/compat/scalar-return-2_main.c: New file.
- * gcc.dg/compat/scalar-return-2_x.c: New file.
- * gcc.dg/compat/scalar-return-2_y.c: New file.
- * gcc.dg/compat/struct-return-3_main.c: New file.
- * gcc.dg/compat/struct-return-3_y.c: New file.
- * gcc.dg/compat/struct-return-3_x.c: New file.
- * gcc.dg/compat/struct-return-2_main.c: New file.
- * gcc.dg/compat/struct-return-2_x.c: New file.
- * gcc.dg/compat/struct-return-2_y.c: New file.
-
2003-05-19 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/20030225-2.c: New test.
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c b/gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c
new file mode 100644
index 0000000..0dca50b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-1_main.c
@@ -0,0 +1,12 @@
+/* Test function return values. This test includes scalar types that
+ are supported by va_arg. */
+
+extern void scalar_return_1_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ scalar_return_1_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c b/gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c
new file mode 100644
index 0000000..aaa634e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-1_x.c
@@ -0,0 +1,110 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void init##NAME (TYPE *p, TYPE v); \
+extern void checkg##NAME (void); \
+extern TYPE test0##NAME (void); \
+extern TYPE test1##NAME (TYPE); \
+extern TYPE testva##NAME (int n, ...); \
+ \
+void \
+check##NAME (TYPE x, TYPE v) \
+{ \
+ if (x != v) \
+ { \
+ DEBUG_NL; \
+ abort (); \
+ } \
+} \
+ \
+void \
+testit##NAME (void) \
+{ \
+ TYPE rslt; \
+ DEBUG_FPUTS (#NAME); \
+ init##NAME (&g01##NAME, 1); \
+ init##NAME (&g02##NAME, 2); \
+ init##NAME (&g03##NAME, 3); \
+ init##NAME (&g04##NAME, 4); \
+ init##NAME (&g05##NAME, 5); \
+ init##NAME (&g06##NAME, 6); \
+ init##NAME (&g07##NAME, 7); \
+ init##NAME (&g08##NAME, 8); \
+ init##NAME (&g09##NAME, 9); \
+ init##NAME (&g10##NAME, 10); \
+ init##NAME (&g11##NAME, 11); \
+ init##NAME (&g12##NAME, 12); \
+ init##NAME (&g13##NAME, 13); \
+ init##NAME (&g14##NAME, 14); \
+ init##NAME (&g15##NAME, 15); \
+ init##NAME (&g16##NAME, 16); \
+ checkg##NAME (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##NAME (); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##NAME (g01##NAME); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_FPUTS (" testva"); \
+ rslt = testva##NAME (1, g01##NAME); \
+ check##NAME (rslt, g01##NAME); \
+ rslt = testva##NAME (5, g01##NAME, g02##NAME, g03##NAME, \
+ g04##NAME, g05##NAME); \
+ check##NAME (rslt, g05##NAME); \
+ rslt = testva##NAME (9, g01##NAME, g02##NAME, g03##NAME, \
+ g04##NAME, g05##NAME, g06##NAME, \
+ g07##NAME, g08##NAME, g09##NAME); \
+ check##NAME (rslt, g09##NAME); \
+ rslt = testva##NAME (16, g01##NAME, g02##NAME, g03##NAME, \
+ g04##NAME, g05##NAME, g06##NAME, \
+ g07##NAME, g08##NAME, g09##NAME, \
+ g10##NAME, g11##NAME, g12##NAME, \
+ g13##NAME, g14##NAME, g15##NAME, \
+ g16##NAME); \
+ check##NAME (rslt, g16##NAME); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+T(ui, unsigned int, 51)
+T(si, int, (-55))
+T(ul, unsigned long, 61)
+T(sl, long, (-66))
+T(ull, unsigned long long, 71)
+T(sll, long long, (-77))
+T(d, double, 91.0)
+T(ld, long double, 92.0)
+
+#undef T
+
+void
+scalar_return_1_x ()
+{
+#define T(NAME) testit##NAME ();
+
+T(ui)
+T(si)
+T(ul)
+T(sl)
+T(ull)
+T(sll)
+T(d)
+T(ld)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c b/gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c
new file mode 100644
index 0000000..edf332b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-1_y.c
@@ -0,0 +1,94 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void check##NAME (TYPE x, TYPE v); \
+ \
+void \
+init##NAME (TYPE *p, TYPE v) \
+{ \
+ *p = v + INITVAL; \
+} \
+ \
+void \
+checkg##NAME (void) \
+{ \
+ check##NAME (g01##NAME, 1+INITVAL); \
+ check##NAME (g02##NAME, 2+INITVAL); \
+ check##NAME (g03##NAME, 3+INITVAL); \
+ check##NAME (g04##NAME, 4+INITVAL); \
+ check##NAME (g05##NAME, 5+INITVAL); \
+ check##NAME (g06##NAME, 6+INITVAL); \
+ check##NAME (g07##NAME, 7+INITVAL); \
+ check##NAME (g08##NAME, 8+INITVAL); \
+ check##NAME (g09##NAME, 9+INITVAL); \
+ check##NAME (g10##NAME, 10+INITVAL); \
+ check##NAME (g11##NAME, 11+INITVAL); \
+ check##NAME (g12##NAME, 12+INITVAL); \
+ check##NAME (g13##NAME, 13+INITVAL); \
+ check##NAME (g14##NAME, 14+INITVAL); \
+ check##NAME (g15##NAME, 15+INITVAL); \
+ check##NAME (g16##NAME, 16+INITVAL); \
+} \
+ \
+TYPE \
+test0##NAME (void) \
+{ \
+ return g01##NAME; \
+} \
+ \
+TYPE \
+test1##NAME (TYPE x01) \
+{ \
+ return x01; \
+} \
+ \
+TYPE \
+testva##NAME (int n, ...) \
+{ \
+ int i; \
+ TYPE rslt; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ rslt = va_arg (ap, TYPE); \
+ DEBUG_DOT; \
+ } \
+ va_end (ap); \
+ } \
+ return rslt; \
+}
+
+T(ui, unsigned int, 51)
+T(si, int, (-55))
+T(ul, unsigned long, 61)
+T(sl, long, (-66))
+T(ull, unsigned long long, 71)
+T(sll, long long, (-77))
+T(d, double, 91.0)
+T(ld, long double, 92.0)
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c b/gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c
new file mode 100644
index 0000000..56325e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-2_main.c
@@ -0,0 +1,12 @@
+/* Test function return values. This test includes scalar types that
+ are not supported by va_arg. */
+
+extern void scalar_return_2_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ scalar_return_2_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c b/gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c
new file mode 100644
index 0000000..16b4dd8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-2_x.c
@@ -0,0 +1,88 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void init##NAME (TYPE *p, TYPE v); \
+extern void checkg##NAME (void); \
+extern TYPE test0##NAME (void); \
+extern TYPE test1##NAME (TYPE); \
+ \
+void \
+check##NAME (TYPE x, TYPE v) \
+{ \
+ if (x != v) \
+ { \
+ DEBUG_NL; \
+ abort (); \
+ } \
+} \
+ \
+void \
+testit##NAME (void) \
+{ \
+ TYPE rslt; \
+ DEBUG_FPUTS (#NAME); \
+ init##NAME (&g01##NAME, 1); \
+ init##NAME (&g02##NAME, 2); \
+ init##NAME (&g03##NAME, 3); \
+ init##NAME (&g04##NAME, 4); \
+ init##NAME (&g05##NAME, 5); \
+ init##NAME (&g06##NAME, 6); \
+ init##NAME (&g07##NAME, 7); \
+ init##NAME (&g08##NAME, 8); \
+ init##NAME (&g09##NAME, 9); \
+ init##NAME (&g10##NAME, 10); \
+ init##NAME (&g11##NAME, 11); \
+ init##NAME (&g12##NAME, 12); \
+ init##NAME (&g13##NAME, 13); \
+ init##NAME (&g14##NAME, 14); \
+ init##NAME (&g15##NAME, 15); \
+ init##NAME (&g16##NAME, 16); \
+ checkg##NAME (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##NAME (); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##NAME (g01##NAME); \
+ check##NAME (rslt, g01##NAME); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+T(c, char, 21)
+T(uc, unsigned char, 22)
+T(sc, signed char, (-33))
+T(us, unsigned short, 41)
+T(ss, short, (-44))
+T(f, float, 90.0)
+
+#undef T
+
+void
+scalar_return_2_x ()
+{
+#define T(NAME) testit##NAME ();
+
+T(c)
+T(uc)
+T(sc)
+T(us)
+T(ss)
+T(f)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c b/gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c
new file mode 100644
index 0000000..89a824c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/scalar-return-2_y.c
@@ -0,0 +1,73 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(NAME, TYPE, INITVAL) \
+extern TYPE g01##NAME, g02##NAME, g03##NAME, g04##NAME; \
+extern TYPE g05##NAME, g06##NAME, g07##NAME, g08##NAME; \
+extern TYPE g09##NAME, g10##NAME, g11##NAME, g12##NAME; \
+extern TYPE g13##NAME, g14##NAME, g15##NAME, g16##NAME; \
+ \
+extern void check##NAME (TYPE x, TYPE v); \
+ \
+void \
+init##NAME (TYPE *p, TYPE v) \
+{ \
+ *p = v + INITVAL; \
+} \
+ \
+void \
+checkg##NAME (void) \
+{ \
+ check##NAME (g01##NAME, 1+INITVAL); \
+ check##NAME (g02##NAME, 2+INITVAL); \
+ check##NAME (g03##NAME, 3+INITVAL); \
+ check##NAME (g04##NAME, 4+INITVAL); \
+ check##NAME (g05##NAME, 5+INITVAL); \
+ check##NAME (g06##NAME, 6+INITVAL); \
+ check##NAME (g07##NAME, 7+INITVAL); \
+ check##NAME (g08##NAME, 8+INITVAL); \
+ check##NAME (g09##NAME, 9+INITVAL); \
+ check##NAME (g10##NAME, 10+INITVAL); \
+ check##NAME (g11##NAME, 11+INITVAL); \
+ check##NAME (g12##NAME, 12+INITVAL); \
+ check##NAME (g13##NAME, 13+INITVAL); \
+ check##NAME (g14##NAME, 14+INITVAL); \
+ check##NAME (g15##NAME, 15+INITVAL); \
+ check##NAME (g16##NAME, 16+INITVAL); \
+} \
+ \
+TYPE \
+test0##NAME (void) \
+{ \
+ return g01##NAME; \
+} \
+ \
+TYPE \
+test1##NAME (TYPE x01) \
+{ \
+ return x01; \
+}
+
+T(c, char, 21)
+T(uc, unsigned char, 22)
+T(sc, signed char, (-33))
+T(us, unsigned short, 41)
+T(ss, short, (-44))
+T(f, float, 90.0)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-2_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-2_main.c
new file mode 100644
index 0000000..6089c02
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-2_main.c
@@ -0,0 +1,12 @@
+/* Test function return values. This test includes structs that are
+ arrays of unsigned integral scalars. */
+
+extern void struct_return_2_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_return_2_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-2_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-2_x.c
new file mode 100644
index 0000000..aa2c34a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-2_x.c
@@ -0,0 +1,205 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(N, NAME, TYPE) \
+struct S##NAME##N { TYPE i[N]; }; \
+struct S##NAME##N g1s##NAME##N, g2s##NAME##N; \
+struct S##NAME##N g3s##NAME##N, g4s##NAME##N; \
+struct S##NAME##N g5s##NAME##N, g6s##NAME##N; \
+struct S##NAME##N g7s##NAME##N, g8s##NAME##N; \
+struct S##NAME##N g9s##NAME##N, g10s##NAME##N; \
+struct S##NAME##N g11s##NAME##N, g12s##NAME##N; \
+struct S##NAME##N g13s##NAME##N, g14s##NAME##N; \
+struct S##NAME##N g15s##NAME##N, g16s##NAME##N; \
+ \
+extern void init##NAME##N (struct S##NAME##N *p, int i); \
+extern void checkg##NAME##N (void); \
+extern struct S##NAME##N test0##NAME##N (void); \
+extern struct S##NAME##N test1##NAME##N (struct S##NAME##N); \
+extern struct S##NAME##N testva##NAME##N (int n, ...); \
+ \
+void \
+check##NAME##N (struct S##NAME##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ if (p->i[j] != (TYPE) (i + j)) \
+ { \
+ DEBUG_NL; \
+ abort (); \
+ } \
+} \
+ \
+void \
+testit##NAME##N (void) \
+{ \
+ struct S##NAME##N rslt; \
+ DEBUG_FPUTS (#NAME "[" #N "]"); \
+ init##NAME##N ( &g1s##NAME##N, 1*16); \
+ init##NAME##N ( &g2s##NAME##N, 2*16); \
+ init##NAME##N ( &g3s##NAME##N, 3*16); \
+ init##NAME##N ( &g4s##NAME##N, 4*16); \
+ init##NAME##N ( &g5s##NAME##N, 5*16); \
+ init##NAME##N ( &g6s##NAME##N, 6*16); \
+ init##NAME##N ( &g7s##NAME##N, 7*16); \
+ init##NAME##N ( &g8s##NAME##N, 8*16); \
+ init##NAME##N ( &g9s##NAME##N, 9*16); \
+ init##NAME##N (&g10s##NAME##N, 10*16); \
+ init##NAME##N (&g11s##NAME##N, 11*16); \
+ init##NAME##N (&g12s##NAME##N, 12*16); \
+ init##NAME##N (&g13s##NAME##N, 13*16); \
+ init##NAME##N (&g14s##NAME##N, 14*16); \
+ init##NAME##N (&g15s##NAME##N, 15*16); \
+ init##NAME##N (&g16s##NAME##N, 16*16); \
+ checkg##NAME##N (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##NAME##N (); \
+ check##NAME##N (&rslt, 1*16); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##NAME##N (g1s##NAME##N); \
+ check##NAME##N (&rslt, 1*16); \
+ DEBUG_FPUTS (" testva"); \
+ rslt = testva##NAME##N (1, g1s##NAME##N); \
+ check##NAME##N (&rslt, 1*16); \
+ rslt = testva##NAME##N (5, \
+ g1s##NAME##N, g2s##NAME##N, \
+ g3s##NAME##N, g4s##NAME##N, \
+ g5s##NAME##N); \
+ check##NAME##N (&rslt, 5*16); \
+ rslt = testva##NAME##N (9, \
+ g1s##NAME##N, g2s##NAME##N, \
+ g3s##NAME##N, g4s##NAME##N, \
+ g5s##NAME##N, g6s##NAME##N, \
+ g7s##NAME##N, g8s##NAME##N, \
+ g9s##NAME##N); \
+ check##NAME##N (&rslt, 9*16); \
+ rslt = testva##NAME##N (16, \
+ g1s##NAME##N, g2s##NAME##N, \
+ g3s##NAME##N, g4s##NAME##N, \
+ g5s##NAME##N, g6s##NAME##N, \
+ g7s##NAME##N, g8s##NAME##N, \
+ g9s##NAME##N, g10s##NAME##N, \
+ g11s##NAME##N, g12s##NAME##N, \
+ g13s##NAME##N, g14s##NAME##N, \
+ g15s##NAME##N, g16s##NAME##N); \
+ check##NAME##N (&rslt, 16*16); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+T(0, uc, unsigned char)
+T(1, uc, unsigned char)
+T(2, uc, unsigned char)
+T(3, uc, unsigned char)
+T(4, uc, unsigned char)
+T(5, uc, unsigned char)
+T(6, uc, unsigned char)
+T(7, uc, unsigned char)
+T(8, uc, unsigned char)
+T(9, uc, unsigned char)
+T(10, uc, unsigned char)
+T(11, uc, unsigned char)
+T(12, uc, unsigned char)
+T(13, uc, unsigned char)
+T(14, uc, unsigned char)
+T(15, uc, unsigned char)
+T(0, us, unsigned short)
+T(1, us, unsigned short)
+T(2, us, unsigned short)
+T(3, us, unsigned short)
+T(4, us, unsigned short)
+T(5, us, unsigned short)
+T(6, us, unsigned short)
+T(7, us, unsigned short)
+T(8, us, unsigned short)
+T(9, us, unsigned short)
+T(10, us, unsigned short)
+T(11, us, unsigned short)
+T(12, us, unsigned short)
+T(13, us, unsigned short)
+T(14, us, unsigned short)
+T(15, us, unsigned short)
+T(0, ui, unsigned int)
+T(1, ui, unsigned int)
+T(2, ui, unsigned int)
+T(3, ui, unsigned int)
+T(4, ui, unsigned int)
+T(5, ui, unsigned int)
+T(6, ui, unsigned int)
+T(7, ui, unsigned int)
+T(8, ui, unsigned int)
+T(9, ui, unsigned int)
+T(10, ui, unsigned int)
+T(11, ui, unsigned int)
+T(12, ui, unsigned int)
+T(13, ui, unsigned int)
+T(14, ui, unsigned int)
+T(15, ui, unsigned int)
+
+#undef T
+
+void
+struct_return_2_x ()
+{
+#define T(N, NAME, TYPE) testit##NAME##N ();
+
+T(0, uc, unsigned char)
+T(1, uc, unsigned char)
+T(2, uc, unsigned char)
+T(3, uc, unsigned char)
+T(4, uc, unsigned char)
+T(5, uc, unsigned char)
+T(6, uc, unsigned char)
+T(7, uc, unsigned char)
+T(8, uc, unsigned char)
+T(9, uc, unsigned char)
+T(10, uc, unsigned char)
+T(11, uc, unsigned char)
+T(12, uc, unsigned char)
+T(13, uc, unsigned char)
+T(14, uc, unsigned char)
+T(15, uc, unsigned char)
+T(0, us, unsigned short)
+T(1, us, unsigned short)
+T(2, us, unsigned short)
+T(3, us, unsigned short)
+T(4, us, unsigned short)
+T(5, us, unsigned short)
+T(6, us, unsigned short)
+T(7, us, unsigned short)
+T(8, us, unsigned short)
+T(9, us, unsigned short)
+T(10, us, unsigned short)
+T(11, us, unsigned short)
+T(12, us, unsigned short)
+T(13, us, unsigned short)
+T(14, us, unsigned short)
+T(15, us, unsigned short)
+T(0, ui, unsigned int)
+T(1, ui, unsigned int)
+T(2, ui, unsigned int)
+T(3, ui, unsigned int)
+T(4, ui, unsigned int)
+T(5, ui, unsigned int)
+T(6, ui, unsigned int)
+T(7, ui, unsigned int)
+T(8, ui, unsigned int)
+T(9, ui, unsigned int)
+T(10, ui, unsigned int)
+T(11, ui, unsigned int)
+T(12, ui, unsigned int)
+T(13, ui, unsigned int)
+T(14, ui, unsigned int)
+T(15, ui, unsigned int)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-2_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-2_y.c
new file mode 100644
index 0000000..50f3cc7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-2_y.c
@@ -0,0 +1,142 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#define T(N, NAME, TYPE) \
+struct S##NAME##N { TYPE i[N]; }; \
+ \
+extern struct S##NAME##N g1s##NAME##N, g2s##NAME##N; \
+extern struct S##NAME##N g3s##NAME##N, g4s##NAME##N; \
+extern struct S##NAME##N g5s##NAME##N, g6s##NAME##N; \
+extern struct S##NAME##N g7s##NAME##N, g8s##NAME##N; \
+extern struct S##NAME##N g9s##NAME##N, g10s##NAME##N; \
+extern struct S##NAME##N g11s##NAME##N, g12s##NAME##N; \
+extern struct S##NAME##N g13s##NAME##N, g14s##NAME##N; \
+extern struct S##NAME##N g15s##NAME##N, g16s##NAME##N; \
+ \
+extern void check##NAME##N (struct S##NAME##N *p, int i); \
+ \
+void \
+init##NAME##N (struct S##NAME##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ p->i[j] = i + j; \
+} \
+ \
+void \
+checkg##NAME##N (void) \
+{ \
+ check##NAME##N ( &g1s##NAME##N, 1*16); \
+ check##NAME##N ( &g2s##NAME##N, 2*16); \
+ check##NAME##N ( &g3s##NAME##N, 3*16); \
+ check##NAME##N ( &g4s##NAME##N, 4*16); \
+ check##NAME##N ( &g5s##NAME##N, 5*16); \
+ check##NAME##N ( &g6s##NAME##N, 6*16); \
+ check##NAME##N ( &g7s##NAME##N, 7*16); \
+ check##NAME##N ( &g8s##NAME##N, 8*16); \
+ check##NAME##N ( &g9s##NAME##N, 9*16); \
+ check##NAME##N (&g10s##NAME##N, 10*16); \
+ check##NAME##N (&g11s##NAME##N, 11*16); \
+ check##NAME##N (&g12s##NAME##N, 12*16); \
+ check##NAME##N (&g13s##NAME##N, 13*16); \
+ check##NAME##N (&g14s##NAME##N, 14*16); \
+ check##NAME##N (&g15s##NAME##N, 15*16); \
+ check##NAME##N (&g16s##NAME##N, 16*16); \
+} \
+ \
+struct S##NAME##N \
+test0##NAME##N (void) \
+{ \
+ return g1s##NAME##N; \
+} \
+ \
+struct S##NAME##N \
+test1##NAME##N (struct S##NAME##N x01) \
+{ \
+ return x01; \
+} \
+ \
+struct S##NAME##N \
+testva##NAME##N (int n, ...) \
+{ \
+ int i; \
+ struct S##NAME##N rslt; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ rslt = va_arg (ap, struct S##NAME##N); \
+ DEBUG_DOT; \
+ } \
+ va_end (ap); \
+ } \
+ return rslt; \
+}
+
+T(0, uc, unsigned char)
+T(1, uc, unsigned char)
+T(2, uc, unsigned char)
+T(3, uc, unsigned char)
+T(4, uc, unsigned char)
+T(5, uc, unsigned char)
+T(6, uc, unsigned char)
+T(7, uc, unsigned char)
+T(8, uc, unsigned char)
+T(9, uc, unsigned char)
+T(10, uc, unsigned char)
+T(11, uc, unsigned char)
+T(12, uc, unsigned char)
+T(13, uc, unsigned char)
+T(14, uc, unsigned char)
+T(15, uc, unsigned char)
+T(0, us, unsigned short)
+T(1, us, unsigned short)
+T(2, us, unsigned short)
+T(3, us, unsigned short)
+T(4, us, unsigned short)
+T(5, us, unsigned short)
+T(6, us, unsigned short)
+T(7, us, unsigned short)
+T(8, us, unsigned short)
+T(9, us, unsigned short)
+T(10, us, unsigned short)
+T(11, us, unsigned short)
+T(12, us, unsigned short)
+T(13, us, unsigned short)
+T(14, us, unsigned short)
+T(15, us, unsigned short)
+T(0, ui, unsigned int)
+T(1, ui, unsigned int)
+T(2, ui, unsigned int)
+T(3, ui, unsigned int)
+T(4, ui, unsigned int)
+T(5, ui, unsigned int)
+T(6, ui, unsigned int)
+T(7, ui, unsigned int)
+T(8, ui, unsigned int)
+T(9, ui, unsigned int)
+T(10, ui, unsigned int)
+T(11, ui, unsigned int)
+T(12, ui, unsigned int)
+T(13, ui, unsigned int)
+T(14, ui, unsigned int)
+T(15, ui, unsigned int)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-3_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-3_main.c
new file mode 100644
index 0000000..87be8a3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-3_main.c
@@ -0,0 +1,13 @@
+/* Test function return values. For this test, all struct members are
+ scalar integral types and the structs are "small": 1, 2, 4, 8, and 12
+ bytes for LP64. */
+
+extern void struct_return_3_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_return_3_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-3_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-3_x.c
new file mode 100644
index 0000000..05d1e50
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-3_x.c
@@ -0,0 +1,122 @@
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+#define T(TYPE) \
+TYPE g01##TYPE, g02##TYPE, g03##TYPE, g04##TYPE; \
+TYPE g05##TYPE, g06##TYPE, g07##TYPE, g08##TYPE; \
+TYPE g09##TYPE, g10##TYPE, g11##TYPE, g12##TYPE; \
+TYPE g13##TYPE, g14##TYPE, g15##TYPE, g16##TYPE; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE (void); \
+extern TYPE test0##TYPE (void); \
+extern TYPE test1##TYPE (TYPE); \
+extern TYPE testva##TYPE (int n, ...); \
+ \
+void \
+testit##TYPE (void) \
+{ \
+ TYPE rslt; \
+ DEBUG_FPUTS (#TYPE); \
+ init##TYPE (&g01##TYPE, 1); \
+ init##TYPE (&g02##TYPE, 2); \
+ init##TYPE (&g03##TYPE, 3); \
+ init##TYPE (&g04##TYPE, 4); \
+ init##TYPE (&g05##TYPE, 5); \
+ init##TYPE (&g06##TYPE, 6); \
+ init##TYPE (&g07##TYPE, 7); \
+ init##TYPE (&g08##TYPE, 8); \
+ init##TYPE (&g09##TYPE, 9); \
+ init##TYPE (&g10##TYPE, 10); \
+ init##TYPE (&g11##TYPE, 11); \
+ init##TYPE (&g12##TYPE, 12); \
+ init##TYPE (&g13##TYPE, 13); \
+ init##TYPE (&g14##TYPE, 14); \
+ init##TYPE (&g15##TYPE, 15); \
+ init##TYPE (&g16##TYPE, 16); \
+ checkg##TYPE (); \
+ DEBUG_FPUTS (" test0"); \
+ rslt = test0##TYPE (); \
+ check##TYPE (rslt, 1); \
+ DEBUG_FPUTS (" test1"); \
+ rslt = test1##TYPE (g01##TYPE); \
+ check##TYPE (rslt, 1); \
+ DEBUG_FPUTS (" testva"); \
+ rslt = testva##TYPE (1, g01##TYPE); \
+ check##TYPE (rslt, 1); \
+ rslt = testva##TYPE (5, g01##TYPE, g02##TYPE, \
+ g03##TYPE, g04##TYPE, \
+ g05##TYPE); \
+ check##TYPE (rslt, 5); \
+ rslt = testva##TYPE (9, g01##TYPE, g02##TYPE, \
+ g03##TYPE, g04##TYPE, \
+ g05##TYPE, g06##TYPE, \
+ g07##TYPE, g08##TYPE, \
+ g09##TYPE); \
+ check##TYPE (rslt, 9); \
+ rslt = testva##TYPE (16, g01##TYPE, g02##TYPE, \
+ g03##TYPE, g04##TYPE, \
+ g05##TYPE, g06##TYPE, \
+ g07##TYPE, g08##TYPE, \
+ g09##TYPE, g10##TYPE, \
+ g11##TYPE, g12##TYPE, \
+ g13##TYPE, g14##TYPE, \
+ g15##TYPE, g16##TYPE); \
+ check##TYPE (rslt, 16); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+#include "small-struct-defs.h"
+#include "small-struct-check.h"
+
+T(Sc)
+T(Ss)
+T(Si)
+T(Scs)
+T(Ssc)
+T(Sic)
+T(Sci)
+T(Ssi)
+T(Sis)
+T(Scsi)
+T(Scis)
+T(Ssci)
+T(Ssic)
+T(Sisc)
+T(Sics)
+
+#undef T
+
+void
+struct_return_3_x ()
+{
+#define T(TYPE) testit##TYPE ();
+
+T(Sc)
+T(Ss)
+T(Si)
+T(Scs)
+T(Ssc)
+T(Sic)
+T(Sci)
+T(Ssi)
+T(Sis)
+T(Scsi)
+T(Scis)
+T(Ssci)
+T(Ssic)
+T(Sisc)
+T(Sics)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-3_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-3_y.c
new file mode 100644
index 0000000..4dc2031
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-3_y.c
@@ -0,0 +1,98 @@
+#include <stdarg.h>
+
+#ifdef DBG
+#include <stdio.h>
+#define DEBUG_FPUTS(x) fputs (x, stdout)
+#define DEBUG_DOT putc ('.', stdout)
+#define DEBUG_NL putc ('\n', stdout)
+#else
+#define DEBUG_FPUTS(x)
+#define DEBUG_DOT
+#define DEBUG_NL
+#endif
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "small-struct-defs.h"
+#include "small-struct-init.h"
+
+#define T(TYPE) \
+extern TYPE g01##TYPE, g02##TYPE, g03##TYPE, g04##TYPE; \
+extern TYPE g05##TYPE, g06##TYPE, g07##TYPE, g08##TYPE; \
+extern TYPE g09##TYPE, g10##TYPE, g11##TYPE, g12##TYPE; \
+extern TYPE g13##TYPE, g14##TYPE, g15##TYPE, g16##TYPE; \
+ \
+extern void check##TYPE (TYPE x, int i); \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE (g01##TYPE, 1); \
+ check##TYPE (g02##TYPE, 2); \
+ check##TYPE (g03##TYPE, 3); \
+ check##TYPE (g04##TYPE, 4); \
+ check##TYPE (g05##TYPE, 5); \
+ check##TYPE (g06##TYPE, 6); \
+ check##TYPE (g07##TYPE, 7); \
+ check##TYPE (g08##TYPE, 8); \
+ check##TYPE (g09##TYPE, 9); \
+ check##TYPE (g10##TYPE, 10); \
+ check##TYPE (g11##TYPE, 11); \
+ check##TYPE (g12##TYPE, 12); \
+ check##TYPE (g13##TYPE, 13); \
+ check##TYPE (g14##TYPE, 14); \
+ check##TYPE (g15##TYPE, 15); \
+ check##TYPE (g16##TYPE, 16); \
+} \
+ \
+TYPE \
+test0##TYPE (void) \
+{ \
+ return g01##TYPE; \
+} \
+ \
+TYPE \
+test1##TYPE (TYPE x01) \
+{ \
+ return x01; \
+} \
+ \
+TYPE \
+testva##TYPE (int n, ...) \
+{ \
+ int i; \
+ TYPE rslt; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ rslt = va_arg (ap, TYPE); \
+ DEBUG_DOT; \
+ } \
+ va_end (ap); \
+ } \
+ return rslt; \
+}
+
+T(Sc)
+T(Ss)
+T(Si)
+T(Scs)
+T(Ssc)
+T(Sic)
+T(Sci)
+T(Ssi)
+T(Sis)
+T(Scsi)
+T(Scis)
+T(Ssci)
+T(Ssic)
+T(Sisc)
+T(Sics)