This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

bug in emit_move_insn_1 ?



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.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]