stack_pointer_delta abort

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Fri Apr 7 06:20:00 GMT 2000


> For D30V (on condexec-branch only at the moment)
> 
> 	main ()
> 	{
> 	  foo (alloca (10000));
> 	}
> 
> triggers
> 
>       /* Verify that we've deallocated all the stack we used.  */
>       if (pass
>           && old_stack_allocated != stack_pointer_delta - pending_stack_adjust)
>         abort();

Hi
The actual problem was that the alloca argument got precalculated later,
than on ia32 in precompute_register_arguments (I am not sure if this is
correct).
Anyway following patch to save stack_allocated later fixes the problem for
me.

Honza

Fri Apr  7 15:02:50 MET DST 2000  Jan Hubicka  <jh@suse.cz>
	* calls.c (expand_call): Save old_stack_allocated and align stack
	after precompute_register_parameters call.


Index: egcs/gcc/calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.115
diff -c -3 -p -r1.115 calls.c
*** calls.c	2000/04/05 01:52:54	1.115
--- calls.c	2000/04/07 13:16:45
*************** expand_call (exp, target, ignore)
*** 2643,2648 ****
--- 2641,2671 ----
  
        compute_argument_addresses (args, argblock, num_actuals);
  
+       /* Don't try to defer pops if preallocating, not even from the first arg,
+ 	 since ARGBLOCK probably refers to the SP.  */
+       if (argblock)
+ 	NO_DEFER_POP;
+ 
+       funexp = rtx_for_function_call (fndecl, exp);
+ 
+       /* Figure out the register where the value, if any, will come back.  */
+       valreg = 0;
+       if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
+ 	  && ! structure_value_addr)
+ 	{
+ 	  if (pcc_struct_value)
+ 	    valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
+ 					  fndecl, (pass == 0));
+ 	  else
+ 	    valreg = hard_function_value (TREE_TYPE (exp), fndecl, (pass == 0));
+ 	}
+ 
+       /* Precompute all register parameters.  It isn't safe to compute anything
+ 	 once we have started filling any specific hard regs.  */
+       precompute_register_parameters (num_actuals, args, &reg_parm_seen);
+ 
+       old_stack_allocated =  stack_pointer_delta - pending_stack_adjust;
+ 
  #ifdef PREFERRED_STACK_BOUNDARY
        /* If we push args individually in reverse order, perform stack alignment
  	 before the first push (the last arg).  */
*************** expand_call (exp, target, ignore)
*** 2675,2703 ****
  	}
  #endif
  
-       /* Don't try to defer pops if preallocating, not even from the first arg,
- 	 since ARGBLOCK probably refers to the SP.  */
-       if (argblock)
- 	NO_DEFER_POP;
- 
-       funexp = rtx_for_function_call (fndecl, exp);
- 
-       /* Figure out the register where the value, if any, will come back.  */
-       valreg = 0;
-       if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
- 	  && ! structure_value_addr)
- 	{
- 	  if (pcc_struct_value)
- 	    valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
- 					  fndecl, (pass == 0));
- 	  else
- 	    valreg = hard_function_value (TREE_TYPE (exp), fndecl, (pass == 0));
- 	}
- 
-       /* Precompute all register parameters.  It isn't safe to compute anything
- 	 once we have started filling any specific hard regs.  */
-       precompute_register_parameters (num_actuals, args, &reg_parm_seen);
- 
  #ifdef REG_PARM_STACK_SPACE
        /* Save the fixed argument area if it's part of the caller's frame and
  	 is clobbered by argument setup for this call.  */
--- 2698,2703 ----


More information about the Gcc-bugs mailing list