aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog21
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-4_main.c2
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-4_x.c128
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-4_y.c64
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5_main.c4
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5_x.c66
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-5_y.c34
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c283
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c219
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c283
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c219
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c210
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c167
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c13
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c210
-rw-r--r--gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c167
19 files changed, 1834 insertions, 295 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 329bc2b..edca0dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,24 @@
+2003-05-16 Janis Johnson <janis187@us.ibm.com>
+
+ * gcc.dg/compat/struct-by-value-4_main.c: Split into multiple tests.
+ * gcc.dg/compat/struct-by-value-4_x.c: Split into multiple tests.
+ * gcc.dg/compat/struct-by-value-4_y.c: Split into multiple tests.
+ * gcc.dg/compat/struct-by-value-5_main.c: Split into multiple tests.
+ * gcc.dg/compat/struct-by-value-5_x.c: Split into multiple tests.
+ * gcc.dg/compat/struct-by-value-5_y.c: Split into multiple tests.
+ * gcc.dg/compat/struct-by-value-6_main.c: New file.
+ * gcc.dg/compat/struct-by-value-6_x.c: New file.
+ * gcc.dg/compat/struct-by-value-6_y.c: New file.
+ * gcc.dg/compat/struct-by-value-7_main.c: New file.
+ * gcc.dg/compat/struct-by-value-7_x.c: New file.
+ * gcc.dg/compat/struct-by-value-7_y.c: New file.
+ * gcc.dg/compat/struct-by-value-8_main.c: New file.
+ * gcc.dg/compat/struct-by-value-8_x.c: New file.
+ * gcc.dg/compat/struct-by-value-8_y.c: New file.
+ * gcc.dg/compat/struct-by-value-9_main.c: New file.
+ * gcc.dg/compat/struct-by-value-9_x.c: New file.
+ * gcc.dg/compat/struct-by-value-9_y.c: New file.
+
2003-05-16 Mark Mitchell <mark@codesourcery.com>
* lib/gcc-dg.exp (gcc-dg-test): Rename to ...
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-4_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-4_main.c
index 22b92d7..0344393 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-by-value-4_main.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-4_main.c
@@ -1,6 +1,6 @@
/* Test structures passed by value, including to a function with a
variable-length argument list. Each struct contains an array
- of small structs: 1, 2, 4, 8, and 12 bytes for LP64. */
+ of small structs with a single member. */
extern void struct_by_value_4_x (void);
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-4_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-4_x.c
index 9ff53ef..e857ac0 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-by-value-4_x.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-4_x.c
@@ -181,70 +181,6 @@ T(12, Si)
T(13, Si)
T(14, Si)
T(15, Si)
-T(0, Ssc)
-T(1, Ssc)
-T(2, Ssc)
-T(3, Ssc)
-T(4, Ssc)
-T(5, Ssc)
-T(6, Ssc)
-T(7, Ssc)
-T(8, Ssc)
-T(9, Ssc)
-T(10, Ssc)
-T(11, Ssc)
-T(12, Ssc)
-T(13, Ssc)
-T(14, Ssc)
-T(15, Ssc)
-T(0, Sis)
-T(1, Sis)
-T(2, Sis)
-T(3, Sis)
-T(4, Sis)
-T(5, Sis)
-T(6, Sis)
-T(7, Sis)
-T(8, Sis)
-T(9, Sis)
-T(10, Sis)
-T(11, Sis)
-T(12, Sis)
-T(13, Sis)
-T(14, Sis)
-T(15, Sis)
-T(0, Scsi)
-T(1, Scsi)
-T(2, Scsi)
-T(3, Scsi)
-T(4, Scsi)
-T(5, Scsi)
-T(6, Scsi)
-T(7, Scsi)
-T(8, Scsi)
-T(9, Scsi)
-T(10, Scsi)
-T(11, Scsi)
-T(12, Scsi)
-T(13, Scsi)
-T(14, Scsi)
-T(15, Scsi)
-T(0, Scis)
-T(1, Scis)
-T(2, Scis)
-T(3, Scis)
-T(4, Scis)
-T(5, Scis)
-T(6, Scis)
-T(7, Scis)
-T(8, Scis)
-T(9, Scis)
-T(10, Scis)
-T(11, Scis)
-T(12, Scis)
-T(13, Scis)
-T(14, Scis)
-T(15, Scis)
#undef T
@@ -301,70 +237,6 @@ T(12, Si)
T(13, Si)
T(14, Si)
T(15, Si)
-T(0, Ssc)
-T(1, Ssc)
-T(2, Ssc)
-T(3, Ssc)
-T(4, Ssc)
-T(5, Ssc)
-T(6, Ssc)
-T(7, Ssc)
-T(8, Ssc)
-T(9, Ssc)
-T(10, Ssc)
-T(11, Ssc)
-T(12, Ssc)
-T(13, Ssc)
-T(14, Ssc)
-T(15, Ssc)
-T(0, Sis)
-T(1, Sis)
-T(2, Sis)
-T(3, Sis)
-T(4, Sis)
-T(5, Sis)
-T(6, Sis)
-T(7, Sis)
-T(8, Sis)
-T(9, Sis)
-T(10, Sis)
-T(11, Sis)
-T(12, Sis)
-T(13, Sis)
-T(14, Sis)
-T(15, Sis)
-T(0, Scsi)
-T(1, Scsi)
-T(2, Scsi)
-T(3, Scsi)
-T(4, Scsi)
-T(5, Scsi)
-T(6, Scsi)
-T(7, Scsi)
-T(8, Scsi)
-T(9, Scsi)
-T(10, Scsi)
-T(11, Scsi)
-T(12, Scsi)
-T(13, Scsi)
-T(14, Scsi)
-T(15, Scsi)
-T(0, Scis)
-T(1, Scis)
-T(2, Scis)
-T(3, Scis)
-T(4, Scis)
-T(5, Scis)
-T(6, Scis)
-T(7, Scis)
-T(8, Scis)
-T(9, Scis)
-T(10, Scis)
-T(11, Scis)
-T(12, Scis)
-T(13, Scis)
-T(14, Scis)
-T(15, Scis)
#undef T
}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-4_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-4_y.c
index e1239d3..1e21d8a 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-by-value-4_y.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-4_y.c
@@ -181,67 +181,3 @@ T(12, Si)
T(13, Si)
T(14, Si)
T(15, Si)
-T(0, Ssc)
-T(1, Ssc)
-T(2, Ssc)
-T(3, Ssc)
-T(4, Ssc)
-T(5, Ssc)
-T(6, Ssc)
-T(7, Ssc)
-T(8, Ssc)
-T(9, Ssc)
-T(10, Ssc)
-T(11, Ssc)
-T(12, Ssc)
-T(13, Ssc)
-T(14, Ssc)
-T(15, Ssc)
-T(0, Sis)
-T(1, Sis)
-T(2, Sis)
-T(3, Sis)
-T(4, Sis)
-T(5, Sis)
-T(6, Sis)
-T(7, Sis)
-T(8, Sis)
-T(9, Sis)
-T(10, Sis)
-T(11, Sis)
-T(12, Sis)
-T(13, Sis)
-T(14, Sis)
-T(15, Sis)
-T(0, Scsi)
-T(1, Scsi)
-T(2, Scsi)
-T(3, Scsi)
-T(4, Scsi)
-T(5, Scsi)
-T(6, Scsi)
-T(7, Scsi)
-T(8, Scsi)
-T(9, Scsi)
-T(10, Scsi)
-T(11, Scsi)
-T(12, Scsi)
-T(13, Scsi)
-T(14, Scsi)
-T(15, Scsi)
-T(0, Scis)
-T(1, Scis)
-T(2, Scis)
-T(3, Scis)
-T(4, Scis)
-T(5, Scis)
-T(6, Scis)
-T(7, Scis)
-T(8, Scis)
-T(9, Scis)
-T(10, Scis)
-T(11, Scis)
-T(12, Scis)
-T(13, Scis)
-T(14, Scis)
-T(15, Scis)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5_main.c
index 3412361..d4e0da6 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-by-value-5_main.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5_main.c
@@ -1,6 +1,6 @@
/* Test structures passed by value, including to a function with a
- variable-length argument lists. All struct members are floating
- point scalars. */
+ variable-length argument lists. All struct members are float
+ scalars. */
extern void struct_by_value_5_x (void);
extern void exit (int);
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5_x.c
index 3b2f3b2..f1a14c4 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-by-value-5_x.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5_x.c
@@ -237,8 +237,6 @@ testit##TYPE (void) \
extern void abort (void);
X(f, float)
-X(d, double)
-X(ld, long double)
T(Sf1, float)
T(Sf2, float)
@@ -256,38 +254,6 @@ T(Sf13, float)
T(Sf14, float)
T(Sf15, float)
T(Sf16, float)
-T(Sd1, double)
-T(Sd2, double)
-T(Sd3, double)
-T(Sd4, double)
-T(Sd5, double)
-T(Sd6, double)
-T(Sd7, double)
-T(Sd8, double)
-T(Sd9, double)
-T(Sd10, double)
-T(Sd11, double)
-T(Sd12, double)
-T(Sd13, double)
-T(Sd14, double)
-T(Sd15, double)
-T(Sd16, double)
-T(Sld1, long double)
-T(Sld2, long double)
-T(Sld3, long double)
-T(Sld4, long double)
-T(Sld5, long double)
-T(Sld6, long double)
-T(Sld7, long double)
-T(Sld8, long double)
-T(Sld9, long double)
-T(Sld10, long double)
-T(Sld11, long double)
-T(Sld12, long double)
-T(Sld13, long double)
-T(Sld14, long double)
-T(Sld15, long double)
-T(Sld16, long double)
#undef T
@@ -312,38 +278,6 @@ T(Sf13, float)
T(Sf14, float)
T(Sf15, float)
T(Sf16, float)
-T(Sd1, double)
-T(Sd2, double)
-T(Sd3, double)
-T(Sd4, double)
-T(Sd5, double)
-T(Sd6, double)
-T(Sd7, double)
-T(Sd8, double)
-T(Sd9, double)
-T(Sd10, double)
-T(Sd11, double)
-T(Sd12, double)
-T(Sd13, double)
-T(Sd14, double)
-T(Sd15, double)
-T(Sd16, double)
-T(Sld1, long double)
-T(Sld2, long double)
-T(Sld3, long double)
-T(Sld4, long double)
-T(Sld5, long double)
-T(Sld6, long double)
-T(Sld7, long double)
-T(Sld8, long double)
-T(Sld9, long double)
-T(Sld10, long double)
-T(Sld11, long double)
-T(Sld12, long double)
-T(Sld13, long double)
-T(Sld14, long double)
-T(Sld15, long double)
-T(Sld16, long double)
#undef T
}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-5_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-5_y.c
index 5242c04..b82bfc3 100644
--- a/gcc/testsuite/gcc.dg/compat/struct-by-value-5_y.c
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-5_y.c
@@ -200,8 +200,6 @@ testva##TYPE (int n, ...) \
}
X(f, float)
-X(d, double)
-X(ld, long double)
T(Sf1, float)
T(Sf2, float)
@@ -219,35 +217,3 @@ T(Sf13, float)
T(Sf14, float)
T(Sf15, float)
T(Sf16, float)
-T(Sd1, double)
-T(Sd2, double)
-T(Sd3, double)
-T(Sd4, double)
-T(Sd5, double)
-T(Sd6, double)
-T(Sd7, double)
-T(Sd8, double)
-T(Sd9, double)
-T(Sd10, double)
-T(Sd11, double)
-T(Sd12, double)
-T(Sd13, double)
-T(Sd14, double)
-T(Sd15, double)
-T(Sd16, double)
-T(Sld1, long double)
-T(Sld2, long double)
-T(Sld3, long double)
-T(Sld4, long double)
-T(Sld5, long double)
-T(Sld6, long double)
-T(Sld7, long double)
-T(Sld8, long double)
-T(Sld9, long double)
-T(Sld10, long double)
-T(Sld11, long double)
-T(Sld12, long double)
-T(Sld13, long double)
-T(Sld14, long double)
-T(Sld15, long double)
-T(Sld16, long double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c
new file mode 100644
index 0000000..4e7308f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are double
+ scalars. */
+
+extern void struct_by_value_6_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_6_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c
new file mode 100644
index 0000000..a83b828
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_x.c
@@ -0,0 +1,283 @@
+#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 X(NAME,TYPEM) \
+typedef struct { TYPEM a; } S##NAME##1; \
+typedef struct { TYPEM a; TYPEM b; } S##NAME##2; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; } S##NAME##3; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; } \
+ S##NAME##4; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; } \
+ S##NAME##5; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; } S##NAME##6; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; } S##NAME##7; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; } S##NAME##8; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; } \
+ S##NAME##9; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; } \
+ S##NAME##10; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; } S##NAME##11; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; } S##NAME##12; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; } S##NAME##13; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; } \
+ S##NAME##14; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; } \
+ S##NAME##15; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; \
+ TYPEM p; } S##NAME##16; \
+ \
+void checkS##NAME##1 (S##NAME##1 x, TYPEM y) \
+{ if (x.a != y) { DEBUG_NL; DEBUG_NL; abort (); } } \
+void checkS##NAME##2 (S##NAME##2 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 ) { DEBUG_NL; abort (); } } \
+void checkS##NAME##3 (S##NAME##3 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 ) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##4 (S##NAME##4 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##5 (S##NAME##5 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4) { DEBUG_NL; abort (); } } \
+void checkS##NAME##6 (S##NAME##6 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5) { DEBUG_NL; abort (); } } \
+void checkS##NAME##7 (S##NAME##7 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##8 (S##NAME##8 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7) { DEBUG_NL; abort (); } } \
+void checkS##NAME##9 (S##NAME##9 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8) { DEBUG_NL; abort (); } } \
+void checkS##NAME##10 (S##NAME##10 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##11 (S##NAME##11 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10) { DEBUG_NL; abort (); } } \
+void checkS##NAME##12 (S##NAME##12 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11) { DEBUG_NL; abort (); } } \
+void checkS##NAME##13 (S##NAME##13 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##14 (S##NAME##14 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13) { DEBUG_NL; abort (); } } \
+void checkS##NAME##15 (S##NAME##15 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13 || x.o != y+14) { DEBUG_NL; abort (); } } \
+void checkS##NAME##16 (S##NAME##16 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13 || x.o != y+14 || x.p != y+15) \
+ { DEBUG_NL; abort (); } }
+
+#define T(TYPE,MTYPE) \
+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, MTYPE x); \
+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); \
+ init##TYPE ( &g1s##TYPE, (MTYPE)1); \
+ init##TYPE ( &g2s##TYPE, (MTYPE)2); \
+ init##TYPE ( &g3s##TYPE, (MTYPE)3); \
+ init##TYPE ( &g4s##TYPE, (MTYPE)4); \
+ init##TYPE ( &g5s##TYPE, (MTYPE)5); \
+ init##TYPE ( &g6s##TYPE, (MTYPE)6); \
+ init##TYPE ( &g7s##TYPE, (MTYPE)7); \
+ init##TYPE ( &g8s##TYPE, (MTYPE)8); \
+ init##TYPE ( &g9s##TYPE, (MTYPE)9); \
+ init##TYPE (&g10s##TYPE, (MTYPE)10); \
+ init##TYPE (&g11s##TYPE, (MTYPE)11); \
+ init##TYPE (&g12s##TYPE, (MTYPE)12); \
+ init##TYPE (&g13s##TYPE, (MTYPE)13); \
+ init##TYPE (&g14s##TYPE, (MTYPE)14); \
+ init##TYPE (&g15s##TYPE, (MTYPE)15); \
+ init##TYPE (&g16s##TYPE, (MTYPE)16); \
+ checkg##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_FPUTS (" testva"); \
+ testva##TYPE (1, \
+ g1s##TYPE); \
+ testva##TYPE (2, \
+ g1s##TYPE, g2s##TYPE); \
+ testva##TYPE (3, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE); \
+ testva##TYPE (4, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE); \
+ testva##TYPE (5, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE); \
+ testva##TYPE (6, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE); \
+ testva##TYPE (7, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE); \
+ testva##TYPE (8, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE); \
+ testva##TYPE (9, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE); \
+ testva##TYPE (10, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE); \
+ 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); \
+ 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); \
+ 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); \
+ 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); \
+ 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); \
+ 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_FPUTS (" test2"); \
+ test2_##TYPE (g1s##TYPE, g3s##TYPE, g5s##TYPE, g7s##TYPE, \
+ g9s##TYPE, g11s##TYPE, g13s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+X(d, double)
+
+T(Sd1, double)
+T(Sd2, double)
+T(Sd3, double)
+T(Sd4, double)
+T(Sd5, double)
+T(Sd6, double)
+T(Sd7, double)
+T(Sd8, double)
+T(Sd9, double)
+T(Sd10, double)
+T(Sd11, double)
+T(Sd12, double)
+T(Sd13, double)
+T(Sd14, double)
+T(Sd15, double)
+T(Sd16, double)
+
+#undef T
+
+void
+struct_by_value_6_x ()
+{
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sd1, double)
+T(Sd2, double)
+T(Sd3, double)
+T(Sd4, double)
+T(Sd5, double)
+T(Sd6, double)
+T(Sd7, double)
+T(Sd8, double)
+T(Sd9, double)
+T(Sd10, double)
+T(Sd11, double)
+T(Sd12, double)
+T(Sd13, double)
+T(Sd14, double)
+T(Sd15, double)
+T(Sd16, double)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c
new file mode 100644
index 0000000..5a8295e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-6_y.c
@@ -0,0 +1,219 @@
+#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 X(NAME,TYPEM) \
+typedef struct { TYPEM a; } S##NAME##1; \
+typedef struct { TYPEM a; TYPEM b; } S##NAME##2; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; } S##NAME##3; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; } \
+ S##NAME##4; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; } \
+ S##NAME##5; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; } S##NAME##6; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; } S##NAME##7; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; } S##NAME##8; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; } \
+ S##NAME##9; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; } \
+ S##NAME##10; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; } S##NAME##11; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; } S##NAME##12; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; } S##NAME##13; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; } \
+ S##NAME##14; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; } \
+ S##NAME##15; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; \
+ TYPEM p; } S##NAME##16; \
+ \
+void initS##NAME##1 (S##NAME##1 *p, TYPEM y) \
+{ p->a = y; } \
+void initS##NAME##2 (S##NAME##2 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; } \
+void initS##NAME##3 (S##NAME##3 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; } \
+void initS##NAME##4 (S##NAME##4 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; } \
+void initS##NAME##5 (S##NAME##5 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; } \
+void initS##NAME##6 (S##NAME##6 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; } \
+void initS##NAME##7 (S##NAME##7 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; } \
+void initS##NAME##8 (S##NAME##8 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; } \
+void initS##NAME##9 (S##NAME##9 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; } \
+void initS##NAME##10 (S##NAME##10 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; } \
+void initS##NAME##11 (S##NAME##11 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; } \
+void initS##NAME##12 (S##NAME##12 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; } \
+void initS##NAME##13 (S##NAME##13 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; } \
+void initS##NAME##14 (S##NAME##14 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; } \
+void initS##NAME##15 (S##NAME##15 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; \
+ p->o = y+14; } \
+void initS##NAME##16 (S##NAME##16 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; \
+ p->o = y+14; p->p = y+15; }
+
+#define T(TYPE,TYPE2) \
+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; \
+ \
+extern void check##TYPE (TYPE x, TYPE2 y); \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE ( g1s##TYPE, (TYPE2)1); \
+ check##TYPE ( g2s##TYPE, (TYPE2)2); \
+ check##TYPE ( g3s##TYPE, (TYPE2)3); \
+ check##TYPE ( g4s##TYPE, (TYPE2)4); \
+ check##TYPE ( g5s##TYPE, (TYPE2)5); \
+ check##TYPE ( g6s##TYPE, (TYPE2)6); \
+ check##TYPE ( g7s##TYPE, (TYPE2)7); \
+ check##TYPE ( g8s##TYPE, (TYPE2)8); \
+ check##TYPE ( g9s##TYPE, (TYPE2)9); \
+ check##TYPE ( g10s##TYPE, (TYPE2)10); \
+ check##TYPE ( g11s##TYPE, (TYPE2)11); \
+ check##TYPE ( g12s##TYPE, (TYPE2)12); \
+ check##TYPE ( g13s##TYPE, (TYPE2)13); \
+ check##TYPE ( g14s##TYPE, (TYPE2)14); \
+ check##TYPE ( g15s##TYPE, (TYPE2)15); \
+ check##TYPE ( g16s##TYPE, (TYPE2)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) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE (s1, (TYPE2)1); \
+ DEBUG_DOT; \
+ check##TYPE (s2, (TYPE2)2); \
+ DEBUG_DOT; \
+ check##TYPE (s3, (TYPE2)3); \
+ DEBUG_DOT; \
+ check##TYPE (s4, (TYPE2)4); \
+ DEBUG_DOT; \
+ check##TYPE (s5, (TYPE2)5); \
+ DEBUG_DOT; \
+ check##TYPE (s6, (TYPE2)6); \
+ DEBUG_DOT; \
+ check##TYPE (s7, (TYPE2)7); \
+ DEBUG_DOT; \
+ check##TYPE (s8, (TYPE2)8); \
+ DEBUG_DOT; \
+ check##TYPE (s9, (TYPE2)9); \
+ DEBUG_DOT; \
+ check##TYPE (s10, (TYPE2)10); \
+ DEBUG_DOT; \
+ check##TYPE (s11, (TYPE2)11); \
+ DEBUG_DOT; \
+ check##TYPE (s12, (TYPE2)12); \
+ DEBUG_DOT; \
+ check##TYPE (s13, (TYPE2)13); \
+ DEBUG_DOT; \
+ check##TYPE (s14, (TYPE2)14); \
+ DEBUG_DOT; \
+ check##TYPE (s15, (TYPE2)15); \
+ DEBUG_DOT; \
+ check##TYPE (s16, (TYPE2)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); \
+ DEBUG_DOT; \
+ check##TYPE (t, (TYPE2)i+1); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+X(d, double)
+
+T(Sd1, double)
+T(Sd2, double)
+T(Sd3, double)
+T(Sd4, double)
+T(Sd5, double)
+T(Sd6, double)
+T(Sd7, double)
+T(Sd8, double)
+T(Sd9, double)
+T(Sd10, double)
+T(Sd11, double)
+T(Sd12, double)
+T(Sd13, double)
+T(Sd14, double)
+T(Sd15, double)
+T(Sd16, double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c
new file mode 100644
index 0000000..7f0264c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument lists. All struct members are long double
+ scalars. */
+
+extern void struct_by_value_7_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_7_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c
new file mode 100644
index 0000000..6ca5622
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_x.c
@@ -0,0 +1,283 @@
+#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 X(NAME,TYPEM) \
+typedef struct { TYPEM a; } S##NAME##1; \
+typedef struct { TYPEM a; TYPEM b; } S##NAME##2; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; } S##NAME##3; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; } \
+ S##NAME##4; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; } \
+ S##NAME##5; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; } S##NAME##6; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; } S##NAME##7; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; } S##NAME##8; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; } \
+ S##NAME##9; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; } \
+ S##NAME##10; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; } S##NAME##11; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; } S##NAME##12; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; } S##NAME##13; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; } \
+ S##NAME##14; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; } \
+ S##NAME##15; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; \
+ TYPEM p; } S##NAME##16; \
+ \
+void checkS##NAME##1 (S##NAME##1 x, TYPEM y) \
+{ if (x.a != y) { DEBUG_NL; DEBUG_NL; abort (); } } \
+void checkS##NAME##2 (S##NAME##2 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 ) { DEBUG_NL; abort (); } } \
+void checkS##NAME##3 (S##NAME##3 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 ) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##4 (S##NAME##4 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##5 (S##NAME##5 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4) { DEBUG_NL; abort (); } } \
+void checkS##NAME##6 (S##NAME##6 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5) { DEBUG_NL; abort (); } } \
+void checkS##NAME##7 (S##NAME##7 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##8 (S##NAME##8 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7) { DEBUG_NL; abort (); } } \
+void checkS##NAME##9 (S##NAME##9 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8) { DEBUG_NL; abort (); } } \
+void checkS##NAME##10 (S##NAME##10 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##11 (S##NAME##11 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10) { DEBUG_NL; abort (); } } \
+void checkS##NAME##12 (S##NAME##12 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11) { DEBUG_NL; abort (); } } \
+void checkS##NAME##13 (S##NAME##13 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12) \
+ { DEBUG_NL; abort (); } } \
+void checkS##NAME##14 (S##NAME##14 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13) { DEBUG_NL; abort (); } } \
+void checkS##NAME##15 (S##NAME##15 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13 || x.o != y+14) { DEBUG_NL; abort (); } } \
+void checkS##NAME##16 (S##NAME##16 x, TYPEM y) \
+{ if (x.a != y || x.b != y+1 || x.c != y+2 || x.d != y+3 \
+ || x.e != y+4 || x.f != y+5 || x.g != y+6 \
+ || x.h != y+7 || x.i != y+8 || x.j != y+9 \
+ || x.k != y+10 || x.l != y+11 || x.m != y+12 \
+ || x.n != y+13 || x.o != y+14 || x.p != y+15) \
+ { DEBUG_NL; abort (); } }
+
+#define T(TYPE,MTYPE) \
+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, MTYPE x); \
+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); \
+ init##TYPE ( &g1s##TYPE, (MTYPE)1); \
+ init##TYPE ( &g2s##TYPE, (MTYPE)2); \
+ init##TYPE ( &g3s##TYPE, (MTYPE)3); \
+ init##TYPE ( &g4s##TYPE, (MTYPE)4); \
+ init##TYPE ( &g5s##TYPE, (MTYPE)5); \
+ init##TYPE ( &g6s##TYPE, (MTYPE)6); \
+ init##TYPE ( &g7s##TYPE, (MTYPE)7); \
+ init##TYPE ( &g8s##TYPE, (MTYPE)8); \
+ init##TYPE ( &g9s##TYPE, (MTYPE)9); \
+ init##TYPE (&g10s##TYPE, (MTYPE)10); \
+ init##TYPE (&g11s##TYPE, (MTYPE)11); \
+ init##TYPE (&g12s##TYPE, (MTYPE)12); \
+ init##TYPE (&g13s##TYPE, (MTYPE)13); \
+ init##TYPE (&g14s##TYPE, (MTYPE)14); \
+ init##TYPE (&g15s##TYPE, (MTYPE)15); \
+ init##TYPE (&g16s##TYPE, (MTYPE)16); \
+ checkg##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_FPUTS (" testva"); \
+ testva##TYPE (1, \
+ g1s##TYPE); \
+ testva##TYPE (2, \
+ g1s##TYPE, g2s##TYPE); \
+ testva##TYPE (3, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE); \
+ testva##TYPE (4, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE); \
+ testva##TYPE (5, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE); \
+ testva##TYPE (6, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE); \
+ testva##TYPE (7, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE); \
+ testva##TYPE (8, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE); \
+ testva##TYPE (9, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE); \
+ testva##TYPE (10, \
+ g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE, \
+ g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE, \
+ g9s##TYPE, g10s##TYPE); \
+ 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); \
+ 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); \
+ 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); \
+ 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); \
+ 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); \
+ 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_FPUTS (" test2"); \
+ test2_##TYPE (g1s##TYPE, g3s##TYPE, g5s##TYPE, g7s##TYPE, \
+ g9s##TYPE, g11s##TYPE, g13s##TYPE, g15s##TYPE); \
+ DEBUG_NL; \
+}
+
+extern void abort (void);
+
+X(ld, long double)
+
+T(Sld1, long double)
+T(Sld2, long double)
+T(Sld3, long double)
+T(Sld4, long double)
+T(Sld5, long double)
+T(Sld6, long double)
+T(Sld7, long double)
+T(Sld8, long double)
+T(Sld9, long double)
+T(Sld10, long double)
+T(Sld11, long double)
+T(Sld12, long double)
+T(Sld13, long double)
+T(Sld14, long double)
+T(Sld15, long double)
+T(Sld16, long double)
+
+#undef T
+
+void
+struct_by_value_7_x ()
+{
+#define T(TYPE, MTYPE) testit##TYPE ();
+
+T(Sld1, long double)
+T(Sld2, long double)
+T(Sld3, long double)
+T(Sld4, long double)
+T(Sld5, long double)
+T(Sld6, long double)
+T(Sld7, long double)
+T(Sld8, long double)
+T(Sld9, long double)
+T(Sld10, long double)
+T(Sld11, long double)
+T(Sld12, long double)
+T(Sld13, long double)
+T(Sld14, long double)
+T(Sld15, long double)
+T(Sld16, long double)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c
new file mode 100644
index 0000000..8f41225
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-7_y.c
@@ -0,0 +1,219 @@
+#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 X(NAME,TYPEM) \
+typedef struct { TYPEM a; } S##NAME##1; \
+typedef struct { TYPEM a; TYPEM b; } S##NAME##2; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; } S##NAME##3; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; } \
+ S##NAME##4; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; } \
+ S##NAME##5; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; } S##NAME##6; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; } S##NAME##7; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; } S##NAME##8; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; } \
+ S##NAME##9; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; } \
+ S##NAME##10; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; } S##NAME##11; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; } S##NAME##12; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; } S##NAME##13; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; } \
+ S##NAME##14; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; } \
+ S##NAME##15; \
+typedef struct { TYPEM a; TYPEM b; TYPEM c; TYPEM d; TYPEM e; \
+ TYPEM f; TYPEM g; TYPEM h; TYPEM i; TYPEM j; \
+ TYPEM k; TYPEM l; TYPEM m; TYPEM n; TYPEM o; \
+ TYPEM p; } S##NAME##16; \
+ \
+void initS##NAME##1 (S##NAME##1 *p, TYPEM y) \
+{ p->a = y; } \
+void initS##NAME##2 (S##NAME##2 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; } \
+void initS##NAME##3 (S##NAME##3 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; } \
+void initS##NAME##4 (S##NAME##4 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; } \
+void initS##NAME##5 (S##NAME##5 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; } \
+void initS##NAME##6 (S##NAME##6 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; } \
+void initS##NAME##7 (S##NAME##7 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; } \
+void initS##NAME##8 (S##NAME##8 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; } \
+void initS##NAME##9 (S##NAME##9 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; } \
+void initS##NAME##10 (S##NAME##10 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; } \
+void initS##NAME##11 (S##NAME##11 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; } \
+void initS##NAME##12 (S##NAME##12 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; } \
+void initS##NAME##13 (S##NAME##13 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; } \
+void initS##NAME##14 (S##NAME##14 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; } \
+void initS##NAME##15 (S##NAME##15 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; \
+ p->o = y+14; } \
+void initS##NAME##16 (S##NAME##16 *p, TYPEM y) \
+{ p->a = y; p->b = y+1; p->c = y+2; p->d = y+3; p->e = y+4; \
+ p->f = y+5; p->g = y+6; p->h = y+7; p->i = y+8; p->j = y+9; \
+ p->k = y+10; p->l = y+11; p->m = y+12; p->n = y+13; \
+ p->o = y+14; p->p = y+15; }
+
+#define T(TYPE,TYPE2) \
+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; \
+ \
+extern void check##TYPE (TYPE x, TYPE2 y); \
+ \
+void \
+checkg##TYPE (void) \
+{ \
+ check##TYPE ( g1s##TYPE, (TYPE2)1); \
+ check##TYPE ( g2s##TYPE, (TYPE2)2); \
+ check##TYPE ( g3s##TYPE, (TYPE2)3); \
+ check##TYPE ( g4s##TYPE, (TYPE2)4); \
+ check##TYPE ( g5s##TYPE, (TYPE2)5); \
+ check##TYPE ( g6s##TYPE, (TYPE2)6); \
+ check##TYPE ( g7s##TYPE, (TYPE2)7); \
+ check##TYPE ( g8s##TYPE, (TYPE2)8); \
+ check##TYPE ( g9s##TYPE, (TYPE2)9); \
+ check##TYPE ( g10s##TYPE, (TYPE2)10); \
+ check##TYPE ( g11s##TYPE, (TYPE2)11); \
+ check##TYPE ( g12s##TYPE, (TYPE2)12); \
+ check##TYPE ( g13s##TYPE, (TYPE2)13); \
+ check##TYPE ( g14s##TYPE, (TYPE2)14); \
+ check##TYPE ( g15s##TYPE, (TYPE2)15); \
+ check##TYPE ( g16s##TYPE, (TYPE2)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) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE (s1, (TYPE2)1); \
+ DEBUG_DOT; \
+ check##TYPE (s2, (TYPE2)2); \
+ DEBUG_DOT; \
+ check##TYPE (s3, (TYPE2)3); \
+ DEBUG_DOT; \
+ check##TYPE (s4, (TYPE2)4); \
+ DEBUG_DOT; \
+ check##TYPE (s5, (TYPE2)5); \
+ DEBUG_DOT; \
+ check##TYPE (s6, (TYPE2)6); \
+ DEBUG_DOT; \
+ check##TYPE (s7, (TYPE2)7); \
+ DEBUG_DOT; \
+ check##TYPE (s8, (TYPE2)8); \
+ DEBUG_DOT; \
+ check##TYPE (s9, (TYPE2)9); \
+ DEBUG_DOT; \
+ check##TYPE (s10, (TYPE2)10); \
+ DEBUG_DOT; \
+ check##TYPE (s11, (TYPE2)11); \
+ DEBUG_DOT; \
+ check##TYPE (s12, (TYPE2)12); \
+ DEBUG_DOT; \
+ check##TYPE (s13, (TYPE2)13); \
+ DEBUG_DOT; \
+ check##TYPE (s14, (TYPE2)14); \
+ DEBUG_DOT; \
+ check##TYPE (s15, (TYPE2)15); \
+ DEBUG_DOT; \
+ check##TYPE (s16, (TYPE2)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); \
+ DEBUG_DOT; \
+ check##TYPE (t, (TYPE2)i+1); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+X(ld, long double)
+
+T(Sld1, long double)
+T(Sld2, long double)
+T(Sld3, long double)
+T(Sld4, long double)
+T(Sld5, long double)
+T(Sld6, long double)
+T(Sld7, long double)
+T(Sld8, long double)
+T(Sld9, long double)
+T(Sld10, long double)
+T(Sld11, long double)
+T(Sld12, long double)
+T(Sld13, long double)
+T(Sld14, long double)
+T(Sld15, long double)
+T(Sld16, long double)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c
new file mode 100644
index 0000000..6ede893
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument list. Each struct contains an array
+ of small structs with two scalar members. */
+
+extern void struct_by_value_8_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_8_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c
new file mode 100644
index 0000000..8695e89
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_x.c
@@ -0,0 +1,210 @@
+#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, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE##N (void); \
+extern void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16); \
+extern void testva##TYPE##N (int n, ...); \
+ \
+ \
+void \
+init##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ init##TYPE(&p->i[j], i+j); \
+} \
+ \
+void \
+check##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ check##TYPE(p->i[j], i+j); \
+} \
+ \
+void \
+test2_##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8) \
+{ \
+ test##TYPE##N (s1, g2s##TYPE##N, s2, g4s##TYPE##N, \
+ s3, g6s##TYPE##N, s4, g8s##TYPE##N, \
+ s5, g10s##TYPE##N, s6, g12s##TYPE##N, \
+ s7, g14s##TYPE##N, s8, g16s##TYPE##N); \
+} \
+ \
+void \
+testit##TYPE##N (void) \
+{ \
+ DEBUG_FPUTS (#TYPE "[" #N "]"); \
+ init##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ init##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ init##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ init##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ init##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ init##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ init##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ init##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ init##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ init##TYPE##N (&g10s##TYPE##N, 10*16); \
+ init##TYPE##N (&g11s##TYPE##N, 11*16); \
+ init##TYPE##N (&g12s##TYPE##N, 12*16); \
+ init##TYPE##N (&g13s##TYPE##N, 13*16); \
+ init##TYPE##N (&g14s##TYPE##N, 14*16); \
+ init##TYPE##N (&g15s##TYPE##N, 15*16); \
+ init##TYPE##N (&g16s##TYPE##N, 16*16); \
+ checkg##TYPE##N (); \
+ DEBUG_FPUTS (" test"); \
+ test##TYPE##N (g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" testva"); \
+ testva##TYPE##N (16, \
+ g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" test2"); \
+ test2_##TYPE##N (g1s##TYPE##N, g3s##TYPE##N, \
+ g5s##TYPE##N, g7s##TYPE##N, \
+ g9s##TYPE##N, g11s##TYPE##N, \
+ g13s##TYPE##N, g15s##TYPE##N); \
+ DEBUG_NL; \
+}
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+extern void abort (void);
+
+void checkSc (Sc x, int i) { if (x.c != i/16) { DEBUG_NL; abort (); } }
+void checkSs (Ss x, int i) { if (x.s != i) { DEBUG_NL; abort (); } }
+void checkSi (Si x, int i) { if (x.i != i) { DEBUG_NL; abort (); } }
+void checkSsc (Ssc x, int i)
+{ if (x.s != i || x.c != (i/16)+1) { DEBUG_NL; abort (); } }
+void checkSis (Sis x, int i)
+{ if (x.i != i || x.s != i+1) { DEBUG_NL; abort (); } }
+void checkScsi (Scsi x, int i)
+{ if (x.c != i/16 || x.s != i+1 || x.i != i+2) { DEBUG_NL; abort (); } }
+void checkScis (Scis x, int i)
+{ if (x.c != i/16 || x.i != i+1 || x.s != i+2) { DEBUG_NL; abort (); } }
+
+T(0, Ssc)
+T(1, Ssc)
+T(2, Ssc)
+T(3, Ssc)
+T(4, Ssc)
+T(5, Ssc)
+T(6, Ssc)
+T(7, Ssc)
+T(8, Ssc)
+T(9, Ssc)
+T(10, Ssc)
+T(11, Ssc)
+T(12, Ssc)
+T(13, Ssc)
+T(14, Ssc)
+T(15, Ssc)
+T(0, Sis)
+T(1, Sis)
+T(2, Sis)
+T(3, Sis)
+T(4, Sis)
+T(5, Sis)
+T(6, Sis)
+T(7, Sis)
+T(8, Sis)
+T(9, Sis)
+T(10, Sis)
+T(11, Sis)
+T(12, Sis)
+T(13, Sis)
+T(14, Sis)
+T(15, Sis)
+
+#undef T
+
+void
+struct_by_value_8_x ()
+{
+#define T(N, TYPE) testit##TYPE##N ();
+
+T(0, Ssc)
+T(1, Ssc)
+T(2, Ssc)
+T(3, Ssc)
+T(4, Ssc)
+T(5, Ssc)
+T(6, Ssc)
+T(7, Ssc)
+T(8, Ssc)
+T(9, Ssc)
+T(10, Ssc)
+T(11, Ssc)
+T(12, Ssc)
+T(13, Ssc)
+T(14, Ssc)
+T(15, Ssc)
+T(0, Sis)
+T(1, Sis)
+T(2, Sis)
+T(3, Sis)
+T(4, Sis)
+T(5, Sis)
+T(6, Sis)
+T(7, Sis)
+T(8, Sis)
+T(9, Sis)
+T(10, Sis)
+T(11, Sis)
+T(12, Sis)
+T(13, Sis)
+T(14, Sis)
+T(15, Sis)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c
new file mode 100644
index 0000000..e776fc3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-8_y.c
@@ -0,0 +1,167 @@
+#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
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+void initSc (Sc *p, int i) { p->c = i/16; }
+void initSs (Ss *p, int i) { p->s = i; }
+void initSi (Si *p, int i) { p->i = i; }
+void initSsc (Ssc *p, int i) { p->s = i; p->c = (i/16)+1; }
+void initSis (Sis *p, int i) { p->i = i; p->s = i+1; }
+void initScsi (Scsi *p, int i) { p->c = i/16; p->s = i+1; p->i = i+2; }
+void initScis (Scis *p, int i) { p->c = i/16; p->i = i+1; p->s = i+2; }
+
+#define T(N, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+extern struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+extern struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+extern struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+extern struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+extern struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+extern struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+extern struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+extern struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void check##TYPE (TYPE x, int i); \
+extern void \
+check##TYPE##N (struct S##TYPE##N *p, int i); \
+ \
+void \
+checkg##TYPE##N (void) \
+{ \
+ check##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ check##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ check##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ check##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ check##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ check##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ check##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ check##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ check##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ check##TYPE##N (&g10s##TYPE##N, 10*16); \
+ check##TYPE##N (&g11s##TYPE##N, 11*16); \
+ check##TYPE##N (&g12s##TYPE##N, 12*16); \
+ check##TYPE##N (&g13s##TYPE##N, 13*16); \
+ check##TYPE##N (&g14s##TYPE##N, 14*16); \
+ check##TYPE##N (&g15s##TYPE##N, 15*16); \
+ check##TYPE##N (&g16s##TYPE##N, 16*16); \
+} \
+ \
+void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE##N (&s1, 1*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s2, 2*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s3, 3*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s4, 4*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s5, 5*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s6, 6*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s7, 7*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s8, 8*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s9, 9*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s10, 10*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s11, 11*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s12, 12*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s13, 13*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s14, 14*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s15, 15*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s16, 16*16); \
+} \
+ \
+void \
+testva##TYPE##N (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ struct S##TYPE##N t = va_arg (ap, struct S##TYPE##N); \
+ DEBUG_DOT; \
+ check##TYPE##N (&t, (i+1)*16); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+T(0, Ssc)
+T(1, Ssc)
+T(2, Ssc)
+T(3, Ssc)
+T(4, Ssc)
+T(5, Ssc)
+T(6, Ssc)
+T(7, Ssc)
+T(8, Ssc)
+T(9, Ssc)
+T(10, Ssc)
+T(11, Ssc)
+T(12, Ssc)
+T(13, Ssc)
+T(14, Ssc)
+T(15, Ssc)
+T(0, Sis)
+T(1, Sis)
+T(2, Sis)
+T(3, Sis)
+T(4, Sis)
+T(5, Sis)
+T(6, Sis)
+T(7, Sis)
+T(8, Sis)
+T(9, Sis)
+T(10, Sis)
+T(11, Sis)
+T(12, Sis)
+T(13, Sis)
+T(14, Sis)
+T(15, Sis)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c
new file mode 100644
index 0000000..676ab02
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_main.c
@@ -0,0 +1,13 @@
+/* Test structures passed by value, including to a function with a
+ variable-length argument list. Each struct contains an array
+ of small structs, each with three scalar members. */
+
+extern void struct_by_value_9_x (void);
+extern void exit (int);
+
+int
+main ()
+{
+ struct_by_value_9_x ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c
new file mode 100644
index 0000000..ff8f057
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_x.c
@@ -0,0 +1,210 @@
+#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, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void init##TYPE (TYPE *p, int i); \
+extern void checkg##TYPE##N (void); \
+extern void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16); \
+extern void testva##TYPE##N (int n, ...); \
+ \
+ \
+void \
+init##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ init##TYPE(&p->i[j], i+j); \
+} \
+ \
+void \
+check##TYPE##N (struct S##TYPE##N *p, int i) \
+{ \
+ int j; \
+ for (j = 0; j < N; j++) \
+ check##TYPE(p->i[j], i+j); \
+} \
+ \
+void \
+test2_##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8) \
+{ \
+ test##TYPE##N (s1, g2s##TYPE##N, s2, g4s##TYPE##N, \
+ s3, g6s##TYPE##N, s4, g8s##TYPE##N, \
+ s5, g10s##TYPE##N, s6, g12s##TYPE##N, \
+ s7, g14s##TYPE##N, s8, g16s##TYPE##N); \
+} \
+ \
+void \
+testit##TYPE##N (void) \
+{ \
+ DEBUG_FPUTS (#TYPE "[" #N "]"); \
+ init##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ init##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ init##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ init##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ init##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ init##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ init##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ init##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ init##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ init##TYPE##N (&g10s##TYPE##N, 10*16); \
+ init##TYPE##N (&g11s##TYPE##N, 11*16); \
+ init##TYPE##N (&g12s##TYPE##N, 12*16); \
+ init##TYPE##N (&g13s##TYPE##N, 13*16); \
+ init##TYPE##N (&g14s##TYPE##N, 14*16); \
+ init##TYPE##N (&g15s##TYPE##N, 15*16); \
+ init##TYPE##N (&g16s##TYPE##N, 16*16); \
+ checkg##TYPE##N (); \
+ DEBUG_FPUTS (" test"); \
+ test##TYPE##N (g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" testva"); \
+ testva##TYPE##N (16, \
+ g1s##TYPE##N, g2s##TYPE##N, \
+ g3s##TYPE##N, g4s##TYPE##N, \
+ g5s##TYPE##N, g6s##TYPE##N, \
+ g7s##TYPE##N, g8s##TYPE##N, \
+ g9s##TYPE##N, g10s##TYPE##N, \
+ g11s##TYPE##N, g12s##TYPE##N, \
+ g13s##TYPE##N, g14s##TYPE##N, \
+ g15s##TYPE##N, g16s##TYPE##N); \
+ DEBUG_FPUTS (" test2"); \
+ test2_##TYPE##N (g1s##TYPE##N, g3s##TYPE##N, \
+ g5s##TYPE##N, g7s##TYPE##N, \
+ g9s##TYPE##N, g11s##TYPE##N, \
+ g13s##TYPE##N, g15s##TYPE##N); \
+ DEBUG_NL; \
+}
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+extern void abort (void);
+
+void checkSc (Sc x, int i) { if (x.c != i/16) { DEBUG_NL; abort (); } }
+void checkSs (Ss x, int i) { if (x.s != i) { DEBUG_NL; abort (); } }
+void checkSi (Si x, int i) { if (x.i != i) { DEBUG_NL; abort (); } }
+void checkSsc (Ssc x, int i)
+{ if (x.s != i || x.c != (i/16)+1) { DEBUG_NL; abort (); } }
+void checkSis (Sis x, int i)
+{ if (x.i != i || x.s != i+1) { DEBUG_NL; abort (); } }
+void checkScsi (Scsi x, int i)
+{ if (x.c != i/16 || x.s != i+1 || x.i != i+2) { DEBUG_NL; abort (); } }
+void checkScis (Scis x, int i)
+{ if (x.c != i/16 || x.i != i+1 || x.s != i+2) { DEBUG_NL; abort (); } }
+
+T(0, Scsi)
+T(1, Scsi)
+T(2, Scsi)
+T(3, Scsi)
+T(4, Scsi)
+T(5, Scsi)
+T(6, Scsi)
+T(7, Scsi)
+T(8, Scsi)
+T(9, Scsi)
+T(10, Scsi)
+T(11, Scsi)
+T(12, Scsi)
+T(13, Scsi)
+T(14, Scsi)
+T(15, Scsi)
+T(0, Scis)
+T(1, Scis)
+T(2, Scis)
+T(3, Scis)
+T(4, Scis)
+T(5, Scis)
+T(6, Scis)
+T(7, Scis)
+T(8, Scis)
+T(9, Scis)
+T(10, Scis)
+T(11, Scis)
+T(12, Scis)
+T(13, Scis)
+T(14, Scis)
+T(15, Scis)
+
+#undef T
+
+void
+struct_by_value_9_x ()
+{
+#define T(N, TYPE) testit##TYPE##N ();
+
+T(0, Scsi)
+T(1, Scsi)
+T(2, Scsi)
+T(3, Scsi)
+T(4, Scsi)
+T(5, Scsi)
+T(6, Scsi)
+T(7, Scsi)
+T(8, Scsi)
+T(9, Scsi)
+T(10, Scsi)
+T(11, Scsi)
+T(12, Scsi)
+T(13, Scsi)
+T(14, Scsi)
+T(15, Scsi)
+T(0, Scis)
+T(1, Scis)
+T(2, Scis)
+T(3, Scis)
+T(4, Scis)
+T(5, Scis)
+T(6, Scis)
+T(7, Scis)
+T(8, Scis)
+T(9, Scis)
+T(10, Scis)
+T(11, Scis)
+T(12, Scis)
+T(13, Scis)
+T(14, Scis)
+T(15, Scis)
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c
new file mode 100644
index 0000000..a98e5c9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compat/struct-by-value-9_y.c
@@ -0,0 +1,167 @@
+#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
+
+typedef struct { char c; } Sc;
+typedef struct { short s; } Ss;
+typedef struct { int i; } Si;
+typedef struct { short s; char c; } Ssc;
+typedef struct { int i; short s; } Sis;
+typedef struct { char c; short s; int i; } Scsi;
+typedef struct { char c; int i; short s; } Scis;
+
+void initSc (Sc *p, int i) { p->c = i/16; }
+void initSs (Ss *p, int i) { p->s = i; }
+void initSi (Si *p, int i) { p->i = i; }
+void initSsc (Ssc *p, int i) { p->s = i; p->c = (i/16)+1; }
+void initSis (Sis *p, int i) { p->i = i; p->s = i+1; }
+void initScsi (Scsi *p, int i) { p->c = i/16; p->s = i+1; p->i = i+2; }
+void initScis (Scis *p, int i) { p->c = i/16; p->i = i+1; p->s = i+2; }
+
+#define T(N, TYPE) \
+struct S##TYPE##N { TYPE i[N]; }; \
+ \
+extern struct S##TYPE##N g1s##TYPE##N, g2s##TYPE##N; \
+extern struct S##TYPE##N g3s##TYPE##N, g4s##TYPE##N; \
+extern struct S##TYPE##N g5s##TYPE##N, g6s##TYPE##N; \
+extern struct S##TYPE##N g7s##TYPE##N, g8s##TYPE##N; \
+extern struct S##TYPE##N g9s##TYPE##N, g10s##TYPE##N; \
+extern struct S##TYPE##N g11s##TYPE##N, g12s##TYPE##N; \
+extern struct S##TYPE##N g13s##TYPE##N, g14s##TYPE##N; \
+extern struct S##TYPE##N g15s##TYPE##N, g16s##TYPE##N; \
+ \
+extern void check##TYPE (TYPE x, int i); \
+extern void \
+check##TYPE##N (struct S##TYPE##N *p, int i); \
+ \
+void \
+checkg##TYPE##N (void) \
+{ \
+ check##TYPE##N ( &g1s##TYPE##N, 1*16); \
+ check##TYPE##N ( &g2s##TYPE##N, 2*16); \
+ check##TYPE##N ( &g3s##TYPE##N, 3*16); \
+ check##TYPE##N ( &g4s##TYPE##N, 4*16); \
+ check##TYPE##N ( &g5s##TYPE##N, 5*16); \
+ check##TYPE##N ( &g6s##TYPE##N, 6*16); \
+ check##TYPE##N ( &g7s##TYPE##N, 7*16); \
+ check##TYPE##N ( &g8s##TYPE##N, 8*16); \
+ check##TYPE##N ( &g9s##TYPE##N, 9*16); \
+ check##TYPE##N (&g10s##TYPE##N, 10*16); \
+ check##TYPE##N (&g11s##TYPE##N, 11*16); \
+ check##TYPE##N (&g12s##TYPE##N, 12*16); \
+ check##TYPE##N (&g13s##TYPE##N, 13*16); \
+ check##TYPE##N (&g14s##TYPE##N, 14*16); \
+ check##TYPE##N (&g15s##TYPE##N, 15*16); \
+ check##TYPE##N (&g16s##TYPE##N, 16*16); \
+} \
+ \
+void \
+test##TYPE##N (struct S##TYPE##N s1, struct S##TYPE##N s2, \
+ struct S##TYPE##N s3, struct S##TYPE##N s4, \
+ struct S##TYPE##N s5, struct S##TYPE##N s6, \
+ struct S##TYPE##N s7, struct S##TYPE##N s8, \
+ struct S##TYPE##N s9, struct S##TYPE##N s10, \
+ struct S##TYPE##N s11, struct S##TYPE##N s12, \
+ struct S##TYPE##N s13, struct S##TYPE##N s14, \
+ struct S##TYPE##N s15, struct S##TYPE##N s16) \
+{ \
+ DEBUG_DOT; \
+ check##TYPE##N (&s1, 1*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s2, 2*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s3, 3*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s4, 4*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s5, 5*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s6, 6*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s7, 7*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s8, 8*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s9, 9*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s10, 10*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s11, 11*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s12, 12*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s13, 13*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s14, 14*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s15, 15*16); \
+ DEBUG_DOT; \
+ check##TYPE##N (&s16, 16*16); \
+} \
+ \
+void \
+testva##TYPE##N (int n, ...) \
+{ \
+ int i; \
+ va_list ap; \
+ if (test_va) \
+ { \
+ va_start (ap, n); \
+ for (i = 0; i < n; i++) \
+ { \
+ struct S##TYPE##N t = va_arg (ap, struct S##TYPE##N); \
+ DEBUG_DOT; \
+ check##TYPE##N (&t, (i+1)*16); \
+ } \
+ va_end (ap); \
+ } \
+}
+
+T(0, Scsi)
+T(1, Scsi)
+T(2, Scsi)
+T(3, Scsi)
+T(4, Scsi)
+T(5, Scsi)
+T(6, Scsi)
+T(7, Scsi)
+T(8, Scsi)
+T(9, Scsi)
+T(10, Scsi)
+T(11, Scsi)
+T(12, Scsi)
+T(13, Scsi)
+T(14, Scsi)
+T(15, Scsi)
+T(0, Scis)
+T(1, Scis)
+T(2, Scis)
+T(3, Scis)
+T(4, Scis)
+T(5, Scis)
+T(6, Scis)
+T(7, Scis)
+T(8, Scis)
+T(9, Scis)
+T(10, Scis)
+T(11, Scis)
+T(12, Scis)
+T(13, Scis)
+T(14, Scis)
+T(15, Scis)