From 64ceac43df8d0b74914b438137f89c6afde0ef61 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 24 Apr 2008 08:59:55 +0200 Subject: [PATCH] re PR target/36015 (-mregparm and fn decls without arguments) 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 | 6 ++++++ gcc/config/i386/i386.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr36015.c | 22 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr36015.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 057c7dce215..08b6230876b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-04-24 Jakub Jelinek + + 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 PR rtl-optimization/36006 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 9c12abcd959..70b650b1658 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a11dc7aefa9..2332f6908f9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-24 Jakub Jelinek + + PR target/36015 + * gcc.dg/pr36015.c: New test. + 2008-04-24 Francois-Xavier Coudert PR rtl-optimization/36006 diff --git a/gcc/testsuite/gcc.dg/pr36015.c b/gcc/testsuite/gcc.dg/pr36015.c new file mode 100644 index 00000000000..456ec6ad954 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr36015.c @@ -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; +} -- 2.30.2