This is the mail archive of the gcc-patches@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]

PATCH: Fix pb in combine_stack_adjustments_for_block


Hi!

I have a problem with the new function combine_stack_adjustments_for_block.
The stack adjustment is run after the reload and it tries to
replace a (mem:SI (pre_dec:HI (reg:HI 3 sp)) 0) with (mem:SI (reg:HI 3 sp)).
(regmove.c:2364):

	      && validate_change (insn, &SET_DEST (set),
				  change_address (dest, VOIDmode,
						  stack_pointer_rtx), 0))

The problem is that with the 68HC11, the stack pointer cannot be
used to access the memory directly. You can push/pop but not read/write
with some offset (that is (mem:X (reg:HI sp)) is not valid).

Because the stack adjustment is run after reload, this creates
an abort in change_address (emit-rtl.c:1513):

  if (reload_completed || reload_in_progress)
    {
      if (! memory_address_p (mode, addr))
	abort ();


I suggest to check for validity of stack pointer as a memory address
before calling change_address() in that case.

Thanks,
	Stephane

2000-03-21  Stephane Carrez  <stcarrez@worldnet.fr>

	* regmove.c (combine_stack_adjustments_for_block): Check that
	the stack pointer is a valid memory address.
--- ../egcs-20000320/gcc/regmove.c	Tue Mar 21 20:31:01 2000
+++ gcc/regmove.c	Tue Mar 21 21:09:39 2000
@@ -2361,6 +2361,7 @@ combine_stack_adjustments_for_block (bb)
 	      && GET_CODE (XEXP (dest, 0)) == PRE_DEC
 	      && XEXP (XEXP (dest, 0), 0) == stack_pointer_rtx
 	      && ! reg_mentioned_p (stack_pointer_rtx, src)
+              && memory_address_p (GET_MODE (dest), stack_pointer_rtx)
 	      && validate_change (insn, &SET_DEST (set),
 				  change_address (dest, VOIDmode,
 						  stack_pointer_rtx), 0))

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