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, rs6000: fix PR 36800


This patch fixes PR 38600.  Joseph's suggestion was correct and I have
tested it on powerpc-linux and powerpc64-linux with no regressions.  I
have included the test case from the PR.  Okay for the trunk?

2009-04-09  Ben Elliston  <bje@au.ibm.com>

        PR target/36800
        * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Do not set
        regalign for the reg == fpr and TDmode case.

2009-04-09  Ben Elliston  <bje@au.ibm.com>
            Joseph Myers  <joseph@codesourcery.com>

        PR target/36800
        * gcc.dg/dfp/pr36800.c: New.

Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c      (revision 145794)
+++ config/rs6000/rs6000.c      (working copy)
@@ -7092,7 +7092,6 @@
         reg number is 0 for f1, so we want to make it odd.  */
       else if (reg == fpr && TYPE_MODE (type) == TDmode)
        {
-         regalign = 1;
          t = build2 (BIT_IOR_EXPR, TREE_TYPE (reg), unshare_expr (reg),
                      build_int_cst (TREE_TYPE (reg), 1));
          u = build2 (MODIFY_EXPR, void_type_node, unshare_expr (reg), t);

Index: testsuite/gcc.dg/dfp/pr36800.c
===================================================================
--- testsuite/gcc.dg/dfp/pr36800.c      (revision 0)
+++ testsuite/gcc.dg/dfp/pr36800.c      (revision 0)
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-std=gnu99" } */
+
+#include <stdarg.h>
+extern void abort (void);
+
+void
+f (int a, ...)
+{
+  va_list ap;
+  if (a != 0)
+    abort ();
+  va_start (ap, a);
+  if (va_arg (ap, _Decimal128) != 1.2DL)
+    abort ();
+  if (va_arg (ap, _Decimal128) != 2.34DL)
+    abort ();
+  if (va_arg (ap, _Decimal128) != 3.456DL)
+    abort ();
+  if (va_arg (ap, _Decimal128) != 4.567DL)
+    abort ();
+  if (va_arg (ap, double) != 5.125)
+    abort ();
+  va_end (ap);
+}
+
+int
+main (void)
+{
+  f (0, 1.2DL, 2.34DL, 3.456DL, 4.567DL, 5.125);
+  return 0;
+}



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