[3.1.1/mainline] reg-stack fix

Andreas Jaeger aj@suse.de
Sat Jun 22 07:54:00 GMT 2002


Jan Hubicka <jh@suse.cz> writes:

> Hi,
> this patch fixes bug in reg-stack that makes stack at return to be
> ordered in reverse order than expected. (Ie GCC st(0) deepest in the
> stack).  This does not make problem for i386 as there is never multiple
> registers used for returning the value, but for x86-64 we use
> st(0)/st(1) pairs to return TCmodes
>
> Bootstrapped/regtested i386 and verified to fix the long double bugs on
> x86-64.

And here's the testcase that shows the problem.  The original testcase
is complex long double, but I've added some other types also for
completeness.

I've bootstrapped Honza's patch also successfully on x86-64.

Ok to apply for both 3.1 and mainline if Honza's patch is approved?

Andreas

2002-06-22  Andreas Jaeger  <aj@suse.de>

	* gcc.c-torture/execute/complex-6.c: New.

============================================================
Index: gcc/testsuite/gcc.c-torture/execute/complex-6.c
--- gcc/testsuite/gcc.c-torture/execute/complex-6.c	created
+++ gcc/testsuite/gcc.c-torture/execute/complex-6.c	Sat Jun 22 15:55:52 2002	1.1
@@ -0,0 +1,59 @@
+/* This test tests complex conjugate and passing/returning of
+   complex parameter.  */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int err;
+
+#define TEST(TYPE, FUNC)					\
+__complex__ TYPE						\
+ctest_ ## FUNC (__complex__ TYPE x)				\
+{								\
+  __complex__ TYPE res;						\
+								\
+  res = ~x;							\
+								\
+  return res;							\
+}								\
+								\
+void								\
+test_ ## FUNC (void)						\
+{								\
+  __complex__ TYPE res, x;					\
+								\
+  x = 1.0 + 2.0i;						\
+								\
+  res = ctest_ ## FUNC (x);					\
+								\
+  if (res != 1.0 - 2.0i)					\
+    {								\
+      printf ("test_" #FUNC " failed\n");			\
+      ++err;							\
+    }								\
+}
+
+
+TEST(float, float)
+TEST(double, double)
+TEST(long double, long_double)
+TEST(int, int)
+TEST(long int, long_int)
+
+int
+main (void)
+{
+
+  err = 0;
+
+  test_float ();
+  test_double ();
+  test_long_double ();
+  test_int ();
+  test_long_int ();
+
+  if (err != 0)
+    abort ();
+
+  return 0;
+}

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj



More information about the Gcc-patches mailing list