This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR target/13559


Hi,

This is another deviation from the psABI on SPARC64.  The compiler doesn't 
correctly handle the following structure:

struct sfi {
  float f;
  int i;
  int j;
};

'j' is passed in the right-half of %o1 while the ABI wants the left-half.


Fixed by reverting to 'word_mode' for the second slot of the parameters 
array, once 'i' has been loaded with SImode.  The patch was 
bootstrapped/regtested on sparc64-sun-solaris2.9 (except Ada and libgcj) and 
compat-regtested against the Sun ONE Studio 8 compiler, together with 
Olivier's patch.  It fixes the 2 attached compat testcases.

OK for the compat testcases?


2004-01-21  Eric Botcazou  <ebotcazou@libertysurf.fr>

        PR target/13559
        * config/sparc/sparc.c (function_arg_record_value_3): Revert
	to 'word_mode' once the first slot has been filled.


2004-01-21  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.

-- 
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.c,v
retrieving revision 1.271
diff -u -p -r1.271 sparc.c
--- config/sparc/sparc.c	10 Dec 2003 15:25:41 -0000	1.271
+++ config/sparc/sparc.c	12 Jan 2004 14:33:35 -0000
@@ -4972,7 +4972,7 @@ struct function_arg_record_value_parms
   int named;		/* whether the argument is named.  */
   int regbase;		/* regno of the base register.  */
   int stack;		/* 1 if part of the argument is on the stack.  */
-  int intoffset;	/* offset of the pending integer field.  */
+  int intoffset;	/* offset of the first pending integer field.  */
   unsigned int nregs;	/* number of words passed in registers.  */
 };
 
@@ -5121,6 +5121,7 @@ function_arg_record_value_3 (HOST_WIDE_I
 
       this_slotno += 1;
       intoffset = (intoffset | (UNITS_PER_WORD-1)) + 1;
+      mode = word_mode;
       parms->nregs += 1;
       intslots -= 1;
     }
@@ -5248,6 +5249,7 @@ function_arg_record_value (tree type, en
   parms.intoffset = 0;
   function_arg_record_value_1 (type, 0, &parms, false);
 
+  /* Take into account pending integer fields.  */
   if (parms.intoffset != -1)
     {
       unsigned int startbit, endbit;
Index: gcc.dg/compat/mixed-struct-check.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/mixed-struct-check.h,v
retrieving revision 1.1
diff -u -r1.1 mixed-struct-check.h
--- gcc.dg/compat/mixed-struct-check.h	19 Sep 2003 21:09:52 -0000	1.1
+++ gcc.dg/compat/mixed-struct-check.h	21 Jan 2004 09:13:55 -0000
@@ -26,3 +26,12 @@
 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: gcc.dg/compat/mixed-struct-defs.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/mixed-struct-defs.h,v
retrieving revision 1.1
diff -u -r1.1 mixed-struct-defs.h
--- gcc.dg/compat/mixed-struct-defs.h	19 Sep 2003 21:09:52 -0000	1.1
+++ gcc.dg/compat/mixed-struct-defs.h	21 Jan 2004 09:13:55 -0000
@@ -12,3 +12,8 @@
 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: gcc.dg/compat/mixed-struct-init.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/compat/mixed-struct-init.h,v
retrieving revision 1.1
diff -u -r1.1 mixed-struct-init.h
--- gcc.dg/compat/mixed-struct-init.h	19 Sep 2003 21:09:52 -0000	1.1
+++ gcc.dg/compat/mixed-struct-init.h	21 Jan 2004 09:13:55 -0000
@@ -24,3 +24,12 @@
 { 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; }
--- /dev/null	Thu Apr 11 16:25:15 2002
+++ gcc.dg/compat/struct-by-value-21_main.c	Wed Jan 21 10:00:42 2004
@@ -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_by_value_20_x (void);
+extern void exit (int);
+int fails;
+
+int
+main ()
+{
+  struct_by_value_21_x ();
+  exit (0);
+}
--- /dev/null	Thu Apr 11 16:25:15 2002
+++ gcc.dg/compat/struct-by-value-21_x.c	Wed Jan 21 10:14:53 2004
@@ -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
+}
--- /dev/null	Thu Apr 11 16:25:15 2002
+++ gcc.dg/compat/struct-by-value-21_y.c	Wed Jan 21 10:13:17 2004
@@ -0,0 +1,91 @@
+#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"
+
+extern void checkSfi (Sfi x, int i);
+extern void checkSfii (Sfii x, int i);
+extern void checkSfifi (Sfifi x, int i);
+extern void checkSfiifii (Sfiifii x, int i);
+
+#include "mixed-struct-init.h"
+
+#define T(TYPE)							\
+extern TYPE g1s##TYPE, g2s##TYPE, g3s##TYPE, g4s##TYPE;		\
+extern TYPE g5s##TYPE, g6s##TYPE, g7s##TYPE, g8s##TYPE;		\
+extern TYPE g9s##TYPE, g10s##TYPE, g11s##TYPE, g12s##TYPE;	\
+extern TYPE g13s##TYPE, g14s##TYPE, g15s##TYPE, g16s##TYPE;	\
+								\
+void								\
+checkg##TYPE (void)						\
+{								\
+  check##TYPE (  g1s##TYPE,  1);				\
+  check##TYPE (  g2s##TYPE,  2);				\
+  check##TYPE (  g3s##TYPE,  3);				\
+  check##TYPE (  g4s##TYPE,  4);				\
+  check##TYPE (  g5s##TYPE,  5);				\
+  check##TYPE (  g6s##TYPE,  6);				\
+  check##TYPE (  g7s##TYPE,  7);				\
+  check##TYPE (  g8s##TYPE,  8);				\
+  check##TYPE (  g9s##TYPE,  9);				\
+  check##TYPE ( g10s##TYPE, 10);				\
+  check##TYPE ( g11s##TYPE, 11);				\
+  check##TYPE ( g12s##TYPE, 12);				\
+  check##TYPE ( g13s##TYPE, 13);				\
+  check##TYPE ( g14s##TYPE, 14);				\
+  check##TYPE ( g15s##TYPE, 15);				\
+  check##TYPE ( g16s##TYPE, 16);				\
+}								\
+								\
+void								\
+test##TYPE (TYPE s1, TYPE s2, TYPE s3, TYPE s4,			\
+	    TYPE s5, TYPE s6, TYPE s7, TYPE s8,			\
+	    TYPE s9, TYPE s10, TYPE s11, TYPE s12,		\
+	    TYPE s13, TYPE s14, TYPE s15, TYPE s16)		\
+{								\
+  check##TYPE (s1, 1);						\
+  check##TYPE (s2, 2);						\
+  check##TYPE (s3, 3);						\
+  check##TYPE (s4, 4);						\
+  check##TYPE (s5, 5);						\
+  check##TYPE (s6, 6);						\
+  check##TYPE (s7, 7);						\
+  check##TYPE (s8, 8);						\
+  check##TYPE (s9, 9);						\
+  check##TYPE (s10, 10);					\
+  check##TYPE (s11, 11);					\
+  check##TYPE (s12, 12);					\
+  check##TYPE (s13, 13);					\
+  check##TYPE (s14, 14);					\
+  check##TYPE (s15, 15);					\
+  check##TYPE (s16, 16);					\
+}								\
+								\
+void								\
+testva##TYPE (int n, ...)					\
+{								\
+  int i;							\
+  va_list ap;							\
+  if (test_va)							\
+    {								\
+      va_start (ap, n);						\
+      for (i = 0; i < n; i++)					\
+	{							\
+	  TYPE t = va_arg (ap, TYPE);				\
+	  check##TYPE (t, i+1);					\
+	}							\
+      va_end (ap);						\
+    }								\
+}
+
+T(Sfi)
+T(Sfii)
+T(Sfifi)
+T(Sfiifii)
--- /dev/null	Thu Apr 11 16:25:15 2002
+++ gcc.dg/compat/struct-return-21_main.c	Tue Jan 20 13:00:02 2004
@@ -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);
+}
--- /dev/null	Thu Apr 11 16:25:15 2002
+++ gcc.dg/compat/struct-return-21_x.c	Tue Jan 20 13:00:02 2004
@@ -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
+}
--- /dev/null	Thu Apr 11 16:25:15 2002
+++ gcc.dg/compat/struct-return-21_y.c	Tue Jan 20 13:00:02 2004
@@ -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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]