summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-06 14:31:56 +0000
committerwilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4>1998-02-06 14:31:56 +0000
commit6c74237c12765707a9fb19914caa8cd67a2d032d (patch)
treedb0957b782b9c8bb27b05fe69bfadbe6ad2a8a19
parentcef0b7b2be13349a47b11ae6c3b373c52fb6f047 (diff)
downloadgcc-6c74237c12765707a9fb19914caa8cd67a2d032d.tar.gz
Fix irix6 stdarg failure when last named arg has FP type.
* function.c (assign_parms): New variable named_arg, with value depending on STRICT_ARGUMENT_NAMING. Use instead of ! last_named. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17695 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/function.c26
-rw-r--r--gcc/testsuite/gcc.c-torture/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/980205.c20
4 files changed, 46 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c3f3aac8804..b134080651b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Fri Feb 6 14:20:16 1998 Jim Wilson <wilson@cygnus.com>
+
+ * function.c (assign_parms): New variable named_arg, with value
+ depending on STRICT_ARGUMENT_NAMING. Use instead of ! last_named.
+
Fri Feb 6 14:34:28 1998 Gavin Koch <gavin@cygnus.com>
* mips/t-r3900: New - same as t-ecoff but eliminate
diff --git a/gcc/function.c b/gcc/function.c
index c60bb249f3e..d78d08a41bb 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3632,10 +3632,18 @@ assign_parms (fndecl, second_time)
tree nominal_type = TREE_TYPE (parm);
/* Set LAST_NAMED if this is last named arg before some
- anonymous args. We treat it as if it were anonymous too. */
+ anonymous args. */
int last_named = ((TREE_CHAIN (parm) == 0
|| DECL_NAME (TREE_CHAIN (parm)) == 0)
&& (stdarg || current_function_varargs));
+ /* Set NAMED_ARG if this arg should be treated as a named arg. For
+ most machines, if this is a varargs/stdarg function, then we treat
+ the last named arg as if it were anonymous too. */
+#ifdef STRICT_ARGUMENT_NAMING
+ int named_arg = 1;
+#else
+ int named_arg = ! last_name;
+#endif
if (TREE_TYPE (parm) == error_mark_node
/* This can happen after weird syntax errors
@@ -3684,7 +3692,7 @@ assign_parms (fndecl, second_time)
|| TREE_ADDRESSABLE (passed_type)
#ifdef FUNCTION_ARG_PASS_BY_REFERENCE
|| FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, passed_mode,
- passed_type, ! last_named)
+ passed_type, named_arg)
#endif
)
{
@@ -3704,10 +3712,10 @@ assign_parms (fndecl, second_time)
0 means it arrives on the stack. */
#ifdef FUNCTION_INCOMING_ARG
entry_parm = FUNCTION_INCOMING_ARG (args_so_far, promoted_mode,
- passed_type, ! last_named);
+ passed_type, named_arg);
#else
entry_parm = FUNCTION_ARG (args_so_far, promoted_mode,
- passed_type, ! last_named);
+ passed_type, named_arg);
#endif
if (entry_parm == 0)
@@ -3753,12 +3761,12 @@ assign_parms (fndecl, second_time)
#ifdef FUNCTION_INCOMING_ARG
FUNCTION_INCOMING_ARG (args_so_far, promoted_mode,
passed_type,
- (! last_named
+ (named_arg
|| varargs_setup)) != 0,
#else
FUNCTION_ARG (args_so_far, promoted_mode,
passed_type,
- ! last_named || varargs_setup) != 0,
+ named_arg || varargs_setup) != 0,
#endif
#endif
fndecl, &stack_args_size, &stack_offset, &arg_size);
@@ -3799,7 +3807,7 @@ assign_parms (fndecl, second_time)
if (entry_parm)
{
int nregs = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, promoted_mode,
- passed_type, ! last_named);
+ passed_type, named_arg);
if (nregs > 0)
{
@@ -3864,7 +3872,7 @@ assign_parms (fndecl, second_time)
/* Update info on where next arg arrives in registers. */
FUNCTION_ARG_ADVANCE (args_so_far, promoted_mode,
- passed_type, ! last_named);
+ passed_type, named_arg);
/* If this is our second time through, we are done with this parm. */
if (second_time)
@@ -4106,7 +4114,7 @@ assign_parms (fndecl, second_time)
&& FUNCTION_ARG_CALLEE_COPIES (args_so_far,
TYPE_MODE (DECL_ARG_TYPE (parm)),
DECL_ARG_TYPE (parm),
- ! last_named)
+ named_arg)
&& ! TREE_ADDRESSABLE (DECL_ARG_TYPE (parm)))
{
rtx copy;
diff --git a/gcc/testsuite/gcc.c-torture/ChangeLog b/gcc/testsuite/gcc.c-torture/ChangeLog
index 24f690ac0b9..1715579f6fd 100644
--- a/gcc/testsuite/gcc.c-torture/ChangeLog
+++ b/gcc/testsuite/gcc.c-torture/ChangeLog
@@ -1,3 +1,7 @@
+Fri Feb 6 14:30:48 1998 Jim Wilson <wilson@cygnus.com>
+
+ * execute/980205.c: New test.
+
Mon Dec 8 23:55:26 1997 J"orn Rennecke <amylaar@cygnus.co.uk>
* noncompile/noncompile.exp (921102-1.c): Fixed comment.
diff --git a/gcc/testsuite/gcc.c-torture/execute/980205.c b/gcc/testsuite/gcc.c-torture/execute/980205.c
new file mode 100644
index 00000000000..da15d3c4dd7
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/980205.c
@@ -0,0 +1,20 @@
+#include <stdarg.h>
+
+void fdouble (double one, ...)
+{
+ double value;
+ va_list ap;
+
+ va_start (ap, one);
+ value = va_arg (ap, double);
+ va_end (ap);
+
+ if (one != 1.0 || value != 2.0)
+ abort ();
+}
+
+int main ()
+{
+ fdouble (1.0, 2.0);
+ exit (0);
+}