public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* bug in emit_move_insn_1 ?
@ 2000-09-17  3:30 Denis Chertykov
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Chertykov @ 2000-09-17  3:30 UTC (permalink / raw)
  To: gcc

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bug in emit_move_insn_1 ?
@ 2000-09-22  6:17 Denis Chertykov
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Chertykov @ 2000-09-22  6:17 UTC (permalink / raw)
  To: gcc

Denis Chertykov <denisc@overta.ru> writes:

> 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.

Is anybody know why ?

Why `emit_move_insn_1' adjust `stack_pointer_delta' if port not have a
`movdi' insn ? (only for emitting PUSH)
Why `emit_move_insn_1' not adjust `stack_pointer_delta' if port have a
`movdi' insn ?


Denis.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-09-22  6:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-17  3:30 bug in emit_move_insn_1 ? Denis Chertykov
2000-09-22  6:17 Denis Chertykov

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).