aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJanis Johnson <janis187@us.ibm.com>2003-09-19 21:09:52 +0000
committerJanis Johnson <janis@gcc.gnu.org>2003-09-19 21:09:52 +0000
commit99d53bba4d61a8bd5d23772111f1356aec94c6cc (patch)
treefd2ec64e6db2ab0e6d09629e2c76b213046226f6 /gcc
parentffd9060b5b10cc70fa8b93a3b2c2931628b9b12f (diff)
downloadgcc-99d53bba4d61a8bd5d23772111f1356aec94c6cc.zip
gcc-99d53bba4d61a8bd5d23772111f1356aec94c6cc.tar.gz
gcc-99d53bba4d61a8bd5d23772111f1356aec94c6cc.tar.bz2
mixed-struct-check.h: New.
2003-09-19 Janis Johnson <janis187@us.ibm.com> * gcc.dg/compat/mixed-struct-check.h: New. * gcc.dg/compat/mixed-struct-defs.h: New. * gcc.dg/compat/mixed-struct-init.h: New. * gcc.dg/compat/struct-by-value-19_main.c: New. * gcc.dg/compat/struct-by-value-19_x.c: New. * gcc.dg/compat/struct-by-value-19_y.c: New. * gcc.dg/compat/struct-by-value-20_main.c: New. * gcc.dg/compat/struct-by-value-20_x.c: New. * gcc.dg/compat/struct-by-value-20_y.c: New. * gcc.dg/compat/struct-return-19_main.c: New. * gcc.dg/compat/struct-return-19_x.c: New. * gcc.dg/compat/struct-return-19_y.c: New. * gcc.dg/compat/struct-return-20_main.c: New. * gcc.dg/compat/struct-return-20_x.c: New. * gcc.dg/compat/struct-return-20_y.c: New. From-SVN: r71591
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog18
-rw-r--r--gcc/testsuite/gcc.dg/compat/mixed-struct-check.h28
-rw-r--r--gcc/testsuite/gcc.dg/compat/mixed-struct-defs.h14
-rw-r--r--gcc/testsuite/gcc.dg/compat/mixed-struct-init.h26
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-19_main.c17
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-19_x.c178
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-19_y.c105
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-20_main.c16
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-20_x.c166
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-20_y.c99
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-19_main.c16
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-19_x.c123
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-19_y.c70
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-20_main.c14
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-20_x.c111
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-return-20_y.c64
16 files changed, 1065 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 14d7e39..fbf56c0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,21 @@
+2003-09-19 Janis Johnson <janis187@us.ibm.com>
+
+ * gcc.dg/compat/mixed-struct-check.h: New.
+ * gcc.dg/compat/mixed-struct-defs.h: New.
+ * gcc.dg/compat/mixed-struct-init.h: New.
+ * gcc.dg/compat/struct-by-value-19_main.c: New.
+ * gcc.dg/compat/struct-by-value-19_x.c: New.
+ * gcc.dg/compat/struct-by-value-19_y.c: New.
+ * gcc.dg/compat/struct-by-value-20_main.c: New.
+ * gcc.dg/compat/struct-by-value-20_x.c: New.
+ * gcc.dg/compat/struct-by-value-20_y.c: New.
+ * gcc.dg/compat/struct-return-19_main.c: New.
+ * gcc.dg/compat/struct-return-19_x.c: New.
+ * gcc.dg/compat/struct-return-19_y.c: New.
+ * gcc.dg/compat/struct-return-20_main.c: New.
+ * gcc.dg/compat/struct-return-20_x.c: New.
+ * gcc.dg/compat/struct-return-20_y.c: New.
+
2003-09-19 Andrew Pinski <pinskia@physics.uc.edu>
* g++.dg/init/array11.C: Change unsigned to __SIZE_TYPE__
so that it will not complain on LP64 targets.
diff --git a/gcc/testsuite/gcc.dg/compat/mixed-struct-check.h b/gcc/testsuite/gcc.dg/compat/mixed-struct-check.h
new file mode 100644
index 0000000..dae2050
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/mixed-struct-check.h
@@ -0,0 +1,28 @@
+/* Function definitions that are used by multiple tests. */
+
+void checkScd (Scd x, int i)
+{ if (x.c != (char)i || x.d != (double)i+1) DEBUG_CHECK }
+void checkScdc (Scdc x, int i)
+{ if (x.c != (char)i || x.d != (double)i+1 || x.b != (char)i+2) DEBUG_CHECK }
+void checkSd (Sd x, int i)
+{ if (x.d != (double)i) DEBUG_CHECK }
+void checkSdi (Sdi x, int i)
+{ if (x.d != (double)i || x.i != i+1) DEBUG_CHECK }
+void checkScsds (Scsds x, int i)
+{ if (x.c != (char)i || x.sd.d != (double)i+1) DEBUG_CHECK }
+void checkScsdsc (Scsdsc x, int i)
+{ if (x.c != (char)i || x.sd.d != (double)i+1 || x.b != (char)i+2) DEBUG_CHECK }
+void checkScsdis (Scsdis x, int i)
+{ if (x.c != (char)i || x.sdi.d != (double)i+1 || x.sdi.i != i+2) DEBUG_CHECK }
+void checkScsdisc (Scsdisc x, int i)
+{ if (x.c != (char)i || x.sdi.d != (double)i+1 || x.sdi.i != i+2
+ || x.b != (char)i+3) DEBUG_CHECK }
+void checkSsds (Ssds x, int i)
+{ if (x.sd.d != (double)i) DEBUG_CHECK }
+void checkSsdsc (Ssdsc x, int i)
+{ if (x.sd.d != (double)i || x.c != (char)i+1) DEBUG_CHECK }
+void checkScssdss (Scssdss x, int i)
+{ if (x.c != (char)i || x.ssds.sd.d != (double)i+1) DEBUG_CHECK }
+void checkScssdssc (Scssdssc x, int i)
+{ if (x.c != (char)i || x.ssds.sd.d != (double)i+1
+ || x.b != (char)i+2) DEBUG_CHECK }
diff --git a/gcc/testsuite/gcc.dg/compat/mixed-struct-defs.h b/gcc/testsuite/gcc.dg/compat/mixed-struct-defs.h
new file mode 100644
index 0000000..6b8f4e7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/mixed-struct-defs.h
@@ -0,0 +1,14 @@
+/* Type definitions that are used by multiple tests. */
+
+typedef struct { char c; double d; } Scd;
+typedef struct { char c; double d; char b; } Scdc;
+typedef struct { double d; } Sd;
+typedef struct { double d; int i; } Sdi;
+typedef struct { char c; Sd sd; } Scsds;
+typedef struct { char c; Sd sd; char b; } Scsdsc;
+typedef struct { char c; Sdi sdi; } Scsdis;
+typedef struct { char c; Sdi sdi; char b; } Scsdisc;
+typedef struct { Sd sd; } Ssds;
+typedef struct { Sd sd; char c; } Ssdsc;
+typedef struct { char c; Ssds ssds; } Scssdss;
+typedef struct { char c; Ssds ssds; char b; } Scssdssc;
diff --git a/gcc/testsuite/gcc.dg/compat/mixed-struct-init.h b/gcc/testsuite/gcc.dg/compat/mixed-struct-init.h
new file mode 100644
index 0000000..7a118cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/mixed-struct-init.h
@@ -0,0 +1,26 @@
+/* Function definitions that are used by multiple tests. */
+
+void initScd (Scd *p, int i)
+{ p->c = (char)i; p->d = (double)i+1; }
+void initScdc (Scdc *p, int i)
+{ p->c = (char)i; p->d = (double)i+1; p->b = (char)i+2; }
+void initSd (Sd *p, int i)
+{ p->d = (double)i; }
+void initSdi (Sdi *p, int i)
+{ p->d = (double)i; p->i = i+1; }
+void initScsds (Scsds *p, int i)
+{ p->c = (char)i; p->sd.d = (double)i+1; }
+void initScsdsc (Scsdsc *p, int i)
+{ p->c = (char)i; p->sd.d = (double)i+1; p->b = (char)i+2; }
+void initScsdis (Scsdis *p, int i)
+{ p->c = (char)i; p->sdi.d = (double)i+1; p->sdi.i = i+2; }
+void initScsdisc (Scsdisc *p, int i)
+{ p->c = (char)i; p->sdi.d = (double)i+1; p->sdi.i = i+2; p->b = (char)i+3; }
+void initSsds (Ssds *p, int i)
+{ p->sd.d = (double)i; }
+void initSsdsc (Ssdsc *p, int i)
+{ p->sd.d = (double)i; p->c = (char)i+1; }
+void initScssdss (Scssdss *p, int i)
+{ p->c = (char)i; p->ssds.sd.d = (double)i+1; }
+void initScssdssc (Scssdssc *p, int i)
+{ p->c = (char)i; p->ssds.sd.d = (double)i+1; p->b = (char)i+2; }
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-19_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-19_main.c
new file mode 100644
index 0000000..b0eed4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-19_main.c
@@ -0,0 +1,17 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument list. Struct members are char, int, double,
+ and other structs containing these types. This test was written in
+ response to a layout change for such structs for powerpc64-linux,
+ but this test only checks similar structs that are not affected by
+ that break in compatibility. */
+
+extern void struct_by_value_19_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_19_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-19_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-19_x.c
new file mode 100644
index 0000000..4ccedfd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-19_x.c
@@ -0,0 +1,178 @@
+#include "compat-common.h"
+
+#define T(TYPE) \
+TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
+TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
+TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
+TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE (void); \
+extern void \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
+ TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
+ TYPE s13, TYPE s14, TYPE s15, TYPE s16); \
+extern void testva##TYPE (int n, ...); \
+ \
+void \
+test2_##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8) \
+{ \
+ test##TYPE (s1, g2s##TYPE, s2, g4s##TYPE, \
+ s3, g6s##TYPE, s4, g8s##TYPE, \
+ s5, g10s##TYPE, s6, g12s##TYPE, \
+ s7, g14s##TYPE, s8, g16s##TYPE); \
+} \
+ \
+void \
+testit##TYPE (void) \
+{ \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" init: "); \
+ init##TYPE ( &g1s##TYPE, 1); \
+ init##TYPE ( &g2s##TYPE, 2); \
+ init##TYPE ( &g3s##TYPE, 3); \
+ init##TYPE ( &g4s##TYPE, 4); \
+ init##TYPE ( &g5s##TYPE, 5); \
+ init##TYPE ( &g6s##TYPE, 6); \
+ init##TYPE ( &g7s##TYPE, 7); \
+ init##TYPE ( &g8s##TYPE, 8); \
+ init##TYPE ( &g9s##TYPE, 9); \
+ init##TYPE (&g10s##TYPE, 10); \
+ init##TYPE (&g11s##TYPE, 11); \
+ init##TYPE (&g12s##TYPE, 12); \
+ init##TYPE (&g13s##TYPE, 13); \
+ init##TYPE (&g14s##TYPE, 14); \
+ init##TYPE (&g15s##TYPE, 15); \
+ init##TYPE (&g16s##TYPE, 16); \
+ checkg##TYPE (); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test: "); \
+ test##TYPE (g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" testva:"); \
+ DEBUG_NL; \
+ testva##TYPE (1, \
+ g1s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (2, \
+ g1s##TYPE, g2s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (3, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (4, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (5, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (6, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (7, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (8, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (9, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (10, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (11, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (12, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (13, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (14, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (15, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (16, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test2:"); \
+ test2_##TYPE (g1s##TYPE, g3s##TYPE, g5s##TYPE, g7s##TYPE, \
+ g9s##TYPE, g11s##TYPE, g13s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+}
+
+#include "mixed-struct-defs.h"
+#include "mixed-struct-check.h"
+
+T(Scdc)
+T(Sd)
+T(Sdi)
+T(Scsdsc)
+T(Scsdis)
+T(Scsdisc)
+T(Ssds)
+T(Ssdsc)
+T(Scssdssc)
+
+#undef T
+
+void
+struct_by_value_19_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE) testit##TYPE ();
+
+T(Scdc)
+T(Sd)
+T(Sdi)
+T(Scsdsc)
+T(Scsdis)
+T(Scsdisc)
+T(Ssds)
+T(Ssdsc)
+T(Scssdssc)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-19_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-19_y.c
new file mode 100644
index 0000000..8b0f1e8
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-19_y.c
@@ -0,0 +1,105 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "mixed-struct-defs.h"
+
+extern void checkScd (Scd x, int i);
+extern void checkScdc (Scdc x, int i);
+extern void checkSd (Sd x, int i);
+extern void checkSdi (Sdi x, int i);
+extern void checkScsds (Scsds x, int i);
+extern void checkScsdsc (Scsdsc x, int i);
+extern void checkScsdis (Scsdis x, int i);
+extern void checkScsdisc (Scsdisc x, int i);
+extern void checkSsds (Ssds x, int i);
+extern void checkSsdsc (Ssdsc x, int i);
+extern void checkScssdss (Scssdss x, int i);
+extern void checkScssdssc (Scssdssc x, int i);
+
+#include "mixed-struct-init.h"
+
+#define T(TYPE) \
+extern TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
+extern TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
+extern TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
+extern TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE ( g1s##TYPE, 1); \
+ check##TYPE ( g2s##TYPE, 2); \
+ check##TYPE ( g3s##TYPE, 3); \
+ check##TYPE ( g4s##TYPE, 4); \
+ check##TYPE ( g5s##TYPE, 5); \
+ check##TYPE ( g6s##TYPE, 6); \
+ check##TYPE ( g7s##TYPE, 7); \
+ check##TYPE ( g8s##TYPE, 8); \
+ check##TYPE ( g9s##TYPE, 9); \
+ check##TYPE ( g10s##TYPE, 10); \
+ check##TYPE ( g11s##TYPE, 11); \
+ check##TYPE ( g12s##TYPE, 12); \
+ check##TYPE ( g13s##TYPE, 13); \
+ check##TYPE ( g14s##TYPE, 14); \
+ check##TYPE ( g15s##TYPE, 15); \
+ check##TYPE ( g16s##TYPE, 16); \
+} \
+ \
+void \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
+ TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
+ TYPE s13, TYPE s14, TYPE s15, TYPE s16) \
+{ \
+ check##TYPE (s1, 1); \
+ check##TYPE (s2, 2); \
+ check##TYPE (s3, 3); \
+ check##TYPE (s4, 4); \
+ check##TYPE (s5, 5); \
+ check##TYPE (s6, 6); \
+ check##TYPE (s7, 7); \
+ check##TYPE (s8, 8); \
+ check##TYPE (s9, 9); \
+ check##TYPE (s10, 10); \
+ check##TYPE (s11, 11); \
+ check##TYPE (s12, 12); \
+ check##TYPE (s13, 13); \
+ check##TYPE (s14, 14); \
+ check##TYPE (s15, 15); \
+ check##TYPE (s16, 16); \
+} \
+ \
+void \
+testva##TYPE (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ TYPE t = va_arg (ap, TYPE); \
+ check##TYPE (t, i+1); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+T(Scdc)
+T(Sd)
+T(Sdi)
+T(Scsdsc)
+T(Scsdis)
+T(Scsdisc)
+T(Ssds)
+T(Ssdsc)
+T(Scssdssc)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-20_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-20_main.c
new file mode 100644
index 0000000..64c8f27
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-20_main.c
@@ -0,0 +1,16 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument list. Tested structs end with double.
+ This test was written in response to a layout change for such
+ structs for powerpc64-linux that breaks compatibility between
+ 3.3 and 3.4. */
+
+extern void struct_by_value_20_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_by_value_20_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-20_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-20_x.c
new file mode 100644
index 0000000..183e32d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-20_x.c
@@ -0,0 +1,166 @@
+#include "compat-common.h"
+
+#define T(TYPE) \
+TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
+TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
+TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
+TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE (void); \
+extern void \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
+ TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
+ TYPE s13, TYPE s14, TYPE s15, TYPE s16); \
+extern void testva##TYPE (int n, ...); \
+ \
+void \
+test2_##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8) \
+{ \
+ test##TYPE (s1, g2s##TYPE, s2, g4s##TYPE, \
+ s3, g6s##TYPE, s4, g8s##TYPE, \
+ s5, g10s##TYPE, s6, g12s##TYPE, \
+ s7, g14s##TYPE, s8, g16s##TYPE); \
+} \
+ \
+void \
+testit##TYPE (void) \
+{ \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" init: "); \
+ init##TYPE ( &g1s##TYPE, 1); \
+ init##TYPE ( &g2s##TYPE, 2); \
+ init##TYPE ( &g3s##TYPE, 3); \
+ init##TYPE ( &g4s##TYPE, 4); \
+ init##TYPE ( &g5s##TYPE, 5); \
+ init##TYPE ( &g6s##TYPE, 6); \
+ init##TYPE ( &g7s##TYPE, 7); \
+ init##TYPE ( &g8s##TYPE, 8); \
+ init##TYPE ( &g9s##TYPE, 9); \
+ init##TYPE (&g10s##TYPE, 10); \
+ init##TYPE (&g11s##TYPE, 11); \
+ init##TYPE (&g12s##TYPE, 12); \
+ init##TYPE (&g13s##TYPE, 13); \
+ init##TYPE (&g14s##TYPE, 14); \
+ init##TYPE (&g15s##TYPE, 15); \
+ init##TYPE (&g16s##TYPE, 16); \
+ checkg##TYPE (); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test: "); \
+ test##TYPE (g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" testva:"); \
+ DEBUG_NL; \
+ testva##TYPE (1, \
+ g1s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (2, \
+ g1s##TYPE, g2s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (3, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (4, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (5, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (6, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (7, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (8, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (9, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (10, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (11, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (12, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (13, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (14, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (15, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+ testva##TYPE (16, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE, \
+ g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test2:"); \
+ test2_##TYPE (g1s##TYPE, g3s##TYPE, g5s##TYPE, g7s##TYPE, \
+ g9s##TYPE, g11s##TYPE, g13s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+}
+
+#include "mixed-struct-defs.h"
+#include "mixed-struct-check.h"
+
+T(Scd)
+T(Scsds)
+T(Scssdss)
+
+#undef T
+
+void
+struct_by_value_20_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE) testit##TYPE ();
+
+T(Scd)
+T(Scsds)
+T(Scssdss)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-20_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-20_y.c
new file mode 100644
index 0000000..6e02e7d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-20_y.c
@@ -0,0 +1,99 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "mixed-struct-defs.h"
+
+extern void checkScd (Scd x, int i);
+extern void checkScdc (Scdc x, int i);
+extern void checkSd (Sd x, int i);
+extern void checkSdi (Sdi x, int i);
+extern void checkScsds (Scsds x, int i);
+extern void checkScsdsc (Scsdsc x, int i);
+extern void checkScsdis (Scsdis x, int i);
+extern void checkScsdisc (Scsdisc x, int i);
+extern void checkSsds (Ssds x, int i);
+extern void checkSsdsc (Ssdsc x, int i);
+extern void checkScssdss (Scssdss x, int i);
+extern void checkScssdssc (Scssdssc x, int i);
+
+#include "mixed-struct-init.h"
+
+#define T(TYPE) \
+extern TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE; \
+extern TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE; \
+extern TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE; \
+extern TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE; \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE ( g1s##TYPE, 1); \
+ check##TYPE ( g2s##TYPE, 2); \
+ check##TYPE ( g3s##TYPE, 3); \
+ check##TYPE ( g4s##TYPE, 4); \
+ check##TYPE ( g5s##TYPE, 5); \
+ check##TYPE ( g6s##TYPE, 6); \
+ check##TYPE ( g7s##TYPE, 7); \
+ check##TYPE ( g8s##TYPE, 8); \
+ check##TYPE ( g9s##TYPE, 9); \
+ check##TYPE ( g10s##TYPE, 10); \
+ check##TYPE ( g11s##TYPE, 11); \
+ check##TYPE ( g12s##TYPE, 12); \
+ check##TYPE ( g13s##TYPE, 13); \
+ check##TYPE ( g14s##TYPE, 14); \
+ check##TYPE ( g15s##TYPE, 15); \
+ check##TYPE ( g16s##TYPE, 16); \
+} \
+ \
+void \
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4, \
+ TYPE s5, TYPE s6, TYPE s7, TYPE s8, \
+ TYPE s9, TYPE s10, TYPE s11, TYPE s12, \
+ TYPE s13, TYPE s14, TYPE s15, TYPE s16) \
+{ \
+ check##TYPE (s1, 1); \
+ check##TYPE (s2, 2); \
+ check##TYPE (s3, 3); \
+ check##TYPE (s4, 4); \
+ check##TYPE (s5, 5); \
+ check##TYPE (s6, 6); \
+ check##TYPE (s7, 7); \
+ check##TYPE (s8, 8); \
+ check##TYPE (s9, 9); \
+ check##TYPE (s10, 10); \
+ check##TYPE (s11, 11); \
+ check##TYPE (s12, 12); \
+ check##TYPE (s13, 13); \
+ check##TYPE (s14, 14); \
+ check##TYPE (s15, 15); \
+ check##TYPE (s16, 16); \
+} \
+ \
+void \
+testva##TYPE (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ TYPE t = va_arg (ap, TYPE); \
+ check##TYPE (t, i+1); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+T(Scd)
+T(Scsds)
+T(Scssdss)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-19_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-19_main.c
new file mode 100644
index 0000000..65d8365
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-19_main.c
@@ -0,0 +1,16 @@
+/* Test function return values. Struct members are char, int, double,
+ and other structs containing these types. This test was written in
+ response to a layout change for such structs for powerpc64-linux,
+ but this test only checks similar structs that are not affected by
+ that break in compatibility. */
+
+extern void struct_return_19_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_return_19_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-19_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-19_x.c
new file mode 100644
index 0000000..cb3e8a9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-19_x.c
@@ -0,0 +1,123 @@
+#include "compat-common.h"
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#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); \
+ DEBUG_FPUTS (" init: "); \
+ 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_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test0: "); \
+ rslt = test0##TYPE (); \
+ check##TYPE (rslt, 1); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test1: "); \
+ rslt = test1##TYPE (g01##TYPE); \
+ check##TYPE (rslt, 1); \
+ if (test_va) \
+ { \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ 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; \
+}
+
+#include "mixed-struct-defs.h"
+#include "mixed-struct-check.h"
+
+T(Scdc)
+T(Sd)
+T(Sdi)
+T(Scsdsc)
+T(Scsdis)
+T(Scsdisc)
+T(Ssds)
+T(Ssdsc)
+T(Scssdssc)
+
+#undef T
+
+void
+struct_return_19_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE) testit##TYPE ();
+
+T(Scdc)
+T(Sd)
+T(Sdi)
+T(Scsdsc)
+T(Scsdis)
+T(Scsdisc)
+T(Ssds)
+T(Ssdsc)
+T(Scssdssc)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-19_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-19_y.c
new file mode 100644
index 0000000..6bbbb62
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-19_y.c
@@ -0,0 +1,70 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#include "mixed-struct-defs.h"
+#include "mixed-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; \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ rslt = va_arg (ap, TYPE); \
+ va_end (ap); \
+ return rslt; \
+}
+
+T(Scdc)
+T(Sd)
+T(Sdi)
+T(Scsdsc)
+T(Scsdis)
+T(Scsdisc)
+T(Ssds)
+T(Ssdsc)
+T(Scssdssc)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-20_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-20_main.c
new file mode 100644
index 0000000..7f928ba
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-20_main.c
@@ -0,0 +1,14 @@
+/* Test function return values. Tested structs end with double. This
+ was written in response to a layout change for such structs for
+ powerpc64-linux that breaks compatibility between 3.3 and 3.4. */
+
+extern void struct_return_20_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+ struct_return_20_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-20_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-20_x.c
new file mode 100644
index 0000000..685ef6f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-20_x.c
@@ -0,0 +1,111 @@
+#include "compat-common.h"
+
+/* Turn off checking for variable arguments with -DSKIPVA. */
+#ifdef SKIPVA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#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); \
+ DEBUG_FPUTS (" init: "); \
+ 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_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test0: "); \
+ rslt = test0##TYPE (); \
+ check##TYPE (rslt, 1); \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ DEBUG_FPUTS (" test1: "); \
+ rslt = test1##TYPE (g01##TYPE); \
+ check##TYPE (rslt, 1); \
+ if (test_va) \
+ { \
+ DEBUG_NL; \
+ DEBUG_FPUTS (#TYPE); \
+ 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; \
+}
+
+#include "mixed-struct-defs.h"
+#include "mixed-struct-check.h"
+
+T(Scd)
+T(Scsds)
+T(Scssdss)
+
+#undef T
+
+void
+struct_return_20_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE) testit##TYPE ();
+
+T(Scd)
+T(Scsds)
+T(Scssdss)
+
+DEBUG_FINI
+
+if (fails != 0)
+ abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-20_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-20_y.c
new file mode 100644
index 0000000..2c1c334
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-return-20_y.c
@@ -0,0 +1,64 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#include "mixed-struct-defs.h"
+#include "mixed-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; \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ rslt = va_arg (ap, TYPE); \
+ va_end (ap); \
+ return rslt; \
+}
+
+T(Scd)
+T(Scsds)
+T(Scssdss)