public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@cygnus.com>
To: Jason McMullan <jmcmullan@linuxcare.com>
Cc: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Subject: Re: [PATCH] __builtin_apply / -fdefer-pop bug (ObjC fix!)
Date: Mon, 31 Jul 2000 09:41:00 -0000	[thread overview]
Message-ID: <20000731094105.A6702@cygnus.com> (raw)
In-Reply-To: <20000726163607.A13929@port.evillabs.net>

On Wed, Jul 26, 2000 at 04:36:07PM -0400, Jason McMullan wrote:
> 	When compiled with -fdefer-pop (without the following
> patch) GCC neglects to set the stack pointer appropriately
> after the memcpy() call (to move the stack arguments), and
> the called function (that __builtin_apply() was trying to call)
> is sent a bogus stack pointer.

You didn't point at a test case, which would have been helpful.
Nor did you work against current gcc sources, which have changed.

However, the solution seems reasonable.  I've applied the following.


r~


2000-07-31  Jason McMullan  <jmcmullan@linuxcare.com>

        * builtins.c (expand_builtin_apply): Don't defer pop during
        argument setup.

Index: builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.51
diff -c -p -d -r1.51 builtins.c
*** builtins.c	2000/07/03 18:28:33	1.51
--- builtins.c	2000/07/31 16:34:43
*************** expand_builtin_apply (function, argument
*** 885,892 ****
    /* Perform postincrements before actually calling the function.  */
    emit_queue ();
  
!   /* Push a new argument block and copy the arguments.  */
    do_pending_stack_adjust ();
  
    /* Save the stack with nonlocal if available */
  #ifdef HAVE_save_stack_nonlocal
--- 885,895 ----
    /* Perform postincrements before actually calling the function.  */
    emit_queue ();
  
!   /* Push a new argument block and copy the arguments.  Do not allow
!      the (potential) memcpy call below to interfere with our stack
!      manipulations.  */
    do_pending_stack_adjust ();
+   NO_DEFER_POP;
  
    /* Save the stack with nonlocal if available */
  #ifdef HAVE_save_stack_nonlocal
*************** expand_builtin_apply (function, argument
*** 1025,1030 ****
--- 1028,1035 ----
    else
  #endif
      emit_stack_restore (SAVE_BLOCK, old_stack_level, NULL_RTX);
+ 
+   OK_DEFER_POP;
  
    /* Return the address of the result block.  */
    return copy_addr_to_reg (XEXP (result, 0));

      parent reply	other threads:[~2000-07-31  9:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-07-26 13:36 Jason McMullan
2000-07-27 13:57 ` Ovidiu Predescu
2000-07-27 15:44   ` Jason McMullan
2000-07-31  9:41 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20000731094105.A6702@cygnus.com \
    --to=rth@cygnus.com \
    --cc=gcc-bugs@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=jmcmullan@linuxcare.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).