public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Fix gcc.c-torture/execute/20020307-2.c
@ 2002-07-26  9:21 H. J. Lu
  0 siblings, 0 replies; only message in thread
From: H. J. Lu @ 2002-07-26  9:21 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

gcc.c-torture/execute/20020307-2.c always fails with -mcpu=i686. Also
gcc generates very poor codes when copying args to stack with the
memcpy library call. The problem is PUSH_ARGS_REVERSED is defined
as PUSH_ARGS. For x86, PUSH_ARGS can be zero:

#define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)

But I think we want the stack and args grow in opposite directions
on x86 even if PUSH_ARGS is 0. Here is a patch which fixes
gcc.c-torture/execute/20020307-2.c without any regression.


H.J.

[-- Attachment #2: gcc-var.patch --]
[-- Type: text/plain, Size: 943 bytes --]

2002-07-26  H.J. Lu <hjl@gnu.org>

	* calls.c (PUSH_ARGS_REVERSED): Define only if not defined.

	* config/i386/i386.h (PUSH_ARGS_REVERSED): Set to 1.

--- gcc/calls.c.var	Fri Apr  5 23:25:04 2002
+++ gcc/calls.c	Fri Jul 26 08:24:50 2002
@@ -46,9 +46,11 @@ Software Foundation, 59 Temple Place - S
 
 #ifdef PUSH_ROUNDING
 
+#ifndef PUSH_ARGS_REVERSED
 #if defined (STACK_GROWS_DOWNWARD) != defined (ARGS_GROW_DOWNWARD)
 #define PUSH_ARGS_REVERSED  PUSH_ARGS
 #endif
+#endif
 
 #endif
 
--- gcc/config/i386/i386.h.var	Mon Jul 15 14:36:49 2002
+++ gcc/config/i386/i386.h	Fri Jul 26 08:29:18 2002
@@ -1581,6 +1581,10 @@ enum reg_class
 
 #define PUSH_ARGS (TARGET_PUSH_ARGS && !ACCUMULATE_OUTGOING_ARGS)
 
+/* We want the stack and args grow in opposite directions, even if
+   PUSH_ARGS is 0.  */
+#define PUSH_ARGS_REVERSED 1
+
 /* Offset of first parameter from the argument pointer register value.  */
 #define FIRST_PARM_OFFSET(FNDECL) 0
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-26 15:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-26  9:21 PATCH: Fix gcc.c-torture/execute/20020307-2.c H. J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).