re PR target/36015 (-mregparm and fn decls without arguments)
authorJakub Jelinek <jakub@redhat.com>
Thu, 24 Apr 2008 06:59:55 +0000 (08:59 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 24 Apr 2008 06:59:55 +0000 (08:59 +0200)
PR target/36015
* config/i386/i386.c (init_cumulative_args): Don't pass anything
in registers for -m32 only if stdarg_p (fntype).

* gcc.dg/pr36015.c: New test.

From-SVN: r134621

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr36015.c [new file with mode: 0644]

index 057c7dce215a5f8c776e15b113803c317250db7d..08b6230876b3cb16b270d98f3d2a12333ad18646 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/36015
+       * config/i386/i386.c (init_cumulative_args): Don't pass anything
+       in registers for -m32 only if stdarg_p (fntype).
+
 2008-04-24  Uros Bizjak  <ubizjak@gmail.com>
 
        PR rtl-optimization/36006
index 9c12abcd95965a2dffdf86fddf054e399c27e81d..70b650b165827a199025ae8d5037996d796702b0 100644 (file)
@@ -3552,7 +3552,7 @@ init_cumulative_args (CUMULATIVE_ARGS *cum,  /* Argument info to initialize */
     {
       /* If there are variable arguments, then we won't pass anything
          in registers in 32-bit mode. */
-      if (cum->maybe_vaarg)
+      if (stdarg_p (fntype))
        {
          cum->nregs = 0;
          cum->sse_nregs = 0;
index a11dc7aefa9a182b861d3e5e80085f9a700bbac9..2332f6908f92af6d76a2bb20390ff98f9d54e07c 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-24  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/36015
+       * gcc.dg/pr36015.c: New test.
+
 2008-04-24  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR rtl-optimization/36006
diff --git a/gcc/testsuite/gcc.dg/pr36015.c b/gcc/testsuite/gcc.dg/pr36015.c
new file mode 100644 (file)
index 0000000..456ec6a
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR target/36015 */
+/* { dg-do run } */
+/* { dg-options "-O0" } */
+/* { dg-options "-O0 -mregparm=3" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
+
+static int test ();
+
+int
+main (void)
+{
+  test (0, 1, 2, 3, 4, 5, 6, 7);
+  return 0;
+}
+
+static int
+test (int a, int b, int c, int d, int e, int f, int g, int h)
+{
+  if (a != 0 || b != 1 || c != 2 || d != 3
+      || e != 4 || f != 5 || g != 6 || h != 7)
+    __builtin_abort ();
+  return 0;
+}