mixed-struct-check.h, [...]: Add 4 mixed structure types.
authorEric Botcazou <ebotcazou@libertysurf.fr>
Tue, 16 Mar 2004 18:30:40 +0000 (19:30 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 16 Mar 2004 18:30:40 +0000 (18:30 +0000)
* gcc.dg/compat/mixed-struct-check.h, mixed-struct-defs.h,
mixed-struct-init.h: Add 4 mixed structure types.
struct-by-value-21_main.c, struct-by-value-21_x.c,
struct-by-value-21_y.c, struct-return-21_main.c,
struct-return-21_x.c, struct-return-21_y.c: New files.

From-SVN: r79538

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/compat/mixed-struct-check.h
gcc/testsuite/gcc.dg/compat/mixed-struct-defs.h
gcc/testsuite/gcc.dg/compat/mixed-struct-init.h
gcc/testsuite/gcc.dg/compat/struct-by-value-21_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-by-value-21_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-by-value-21_y.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-return-21_main.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-return-21_x.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/compat/struct-return-21_y.c [new file with mode: 0644]

index 7d1450f..bad99fd 100644 (file)
@@ -1,3 +1,11 @@
+2004-03-16  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/compat/mixed-struct-check.h, mixed-struct-defs.h,
+       mixed-struct-init.h: Add 4 mixed structure types.
+       struct-by-value-21_main.c, struct-by-value-21_x.c,
+       struct-by-value-21_y.c, struct-return-21_main.c,
+       struct-return-21_x.c, struct-return-21_y.c: New files.
+
 2004-03-13  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/14550
index dae2050..248ffb2 100644 (file)
@@ -26,3 +26,12 @@ void checkScssdss (Scssdss x, int i)
 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 }
+
+void checkSfi (Sfi x, int i)
+{ if (x.f != (float)i || x.i != i+1) DEBUG_CHECK }
+void checkSfii (Sfii x, int i)
+{ if (x.f != (float)i || x.i1 != i+1 || x.i2 != i+2) DEBUG_CHECK }
+void checkSfifi (Sfifi x, int i)
+{ if (x.fi.f != (float)i || x.fi.i != i+1) DEBUG_CHECK }
+void checkSfiifii (Sfiifii x, int i)
+{ if (x.fii.f != (float)i || x.fii.i1 != i+1 || x.fii.i2 != i+2) DEBUG_CHECK }
index 6b8f4e7..9a31379 100644 (file)
@@ -12,3 +12,8 @@ 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;
+
+typedef struct { float f; int i; } Sfi;
+typedef struct { float f; int i1; int i2; } Sfii;
+typedef struct { float f; int i; Sfi fi; } Sfifi;
+typedef struct { float f; int i1; int i2; Sfii fii; } Sfiifii;
index 7a118cc..b11fc24 100644 (file)
@@ -24,3 +24,12 @@ 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; }
+
+void initSfi (Sfi *x, int i)
+{ x->f = (float)i; x->i = i+1; }
+void initSfii (Sfii *x, int i)
+{ x->f = (float)i; x->i1 = i+1; x->i2 = i+2; }
+void initSfifi (Sfifi *x, int i)
+{ x->fi.f = (float)i; x->fi.i = i+1; }
+void initSfiifii (Sfiifii *x, int i)
+{ x->fii.f = (float)i; x->fii.i1 = i+1; x->fii.i2 = i+2; }
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-21_main.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-21_main.c
new file mode 100644 (file)
index 0000000..b722bcc
--- /dev/null
@@ -0,0 +1,13 @@
+/* Test function argument passing.  This was written when correcting
+   a deviation from the ABI on SPARC64 between 3.3 and 3.4.  */
+
+extern void struct_by_value_21_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+  struct_by_value_21_x ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-21_x.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-21_x.c
new file mode 100644 (file)
index 0000000..3b01ba8
--- /dev/null
@@ -0,0 +1,168 @@
+#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(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)
+
+#undef T
+
+void
+struct_by_value_21_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE) testit##TYPE ();
+
+T(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)
+
+DEBUG_FINI
+
+if (fails != 0)
+  abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-by-value-21_y.c b/gcc/testsuite/gcc.dg/compat/struct-by-value-21_y.c
new file mode 100644 (file)
index 0000000..fc06d9d
--- /dev/null
@@ -0,0 +1,86 @@
+#include <stdarg.h>
+
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+const int test_va = 0;
+#else
+const int test_va = 1;
+#endif
+
+#include "mixed-struct-defs.h"
+#include "mixed-struct-init.h"
+
+#define T(TYPE)                                                        \
+extern void check##TYPE (TYPE x, int i);                       \
+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(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-21_main.c b/gcc/testsuite/gcc.dg/compat/struct-return-21_main.c
new file mode 100644 (file)
index 0000000..34e0ab4
--- /dev/null
@@ -0,0 +1,13 @@
+/* Test function return values.  This was written when correcting
+   a deviation from the ABI on SPARC64 between 3.3 and 3.4.  */
+
+extern void struct_return_21_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+  struct_return_21_x ();
+  exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-21_x.c b/gcc/testsuite/gcc.dg/compat/struct-return-21_x.c
new file mode 100644 (file)
index 0000000..721deff
--- /dev/null
@@ -0,0 +1,112 @@
+#include "compat-common.h"
+
+#ifdef SKIP_VA
+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(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)
+
+#undef T
+
+void
+struct_return_21_x ()
+{
+DEBUG_INIT
+
+#define T(TYPE) testit##TYPE ();
+
+T(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)
+
+DEBUG_FINI
+
+if (fails != 0)
+  abort ();
+
+#undef T
+}
diff --git a/gcc/testsuite/gcc.dg/compat/struct-return-21_y.c b/gcc/testsuite/gcc.dg/compat/struct-return-21_y.c
new file mode 100644 (file)
index 0000000..b44d7f5
--- /dev/null
@@ -0,0 +1,65 @@
+#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(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)