public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Denis Chertykov <denisc@overta.ru>
To: gcc@gcc.gnu.org
Subject: bug in emit_move_insn_1 ?
Date: Sun, 17 Sep 2000 03:30:00 -0000	[thread overview]
Message-ID: <200009171030.OAA32672@tigris.overta.ru> (raw)

I'm use CVS GCC and AVR port.

void f(int n, ...);
main ()
{
  f (4, 1LL); /* avr-gcc must pass parameters through STACK */
  exit (0);
}

While I'm compile this example GCC aborts
in expand_call, at calls.c:3082

      /* Verify that we've deallocated all the stack we used.  */
      if (pass
	  && old_stack_allocated != stack_pointer_delta - pending_stack_adjust)
	abort ();

GCC aborts because old_stack_allocated = 0, stack_pointer_delta = 18
and pending_stack_adjust = 10.
So, (stack_pointer_delta - pending_stack_adjust) is 8.
IMHO: stack_pointer_delta have a wrong value because call of
`f(4, 1LL)' must pass 10 bytes through stack.
(4 is a 16bits `int' - 2 bytes, 1LL is a 64bits `long long' - 8 bytes).


While I have debugged this bug I founded a strange thing in
`emit_move_insn_1'. (only for emitting PUSH)

If port not have a movMM pattern then `stack_pointer_delta' will be
adjusted in `anti_adjust_stack' which will be called.
If port have a movMM pattern then `emit_insn' will be called and
`stack_pointer_delta' will not be adjusted.

emit_move_insn_1:

  if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
    return
--->>> emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));

  /* Expand complex moves by moving real part and imag part, if possible.  */
  else if ((class == MODE_COMPLEX_FLOAT || class == MODE_COMPLEX_INT)
...
...
...
  /* This will handle any multi-word mode that lacks a move_insn pattern.
     However, you will get better code if you define such patterns,
     even if they must turn into multiple assembler instructions.  */
  else if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
    {
      rtx last_insn = 0;
      rtx seq, inner;
      int need_clobber;

#ifdef PUSH_ROUNDING

      /* If X is a push on the stack, do the push now and replace
	 X with a reference to the stack pointer.  */
      if (push_operand (x, GET_MODE (x)))
	{
---->>>	  anti_adjust_stack (GEN_INT (GET_MODE_SIZE (GET_MODE (x))));
	  x = change_address (x, VOIDmode, stack_pointer_rtx);
	}
#endif

-----------------------------------------------------

Any suggestions ?

May be call of
`anti_adjust_stack (GEN_INT (GET_MODE_SIZE (GET_MODE (x))))' must be removed ??

Denis.


             reply	other threads:[~2000-09-17  3:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-17  3:30 Denis Chertykov [this message]
2000-09-22  6:17 Denis Chertykov

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=200009171030.OAA32672@tigris.overta.ru \
    --to=denisc@overta.ru \
    --cc=gcc@gcc.gnu.org \
    /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).