Real purpose for failure in "Too restrictive sanity check"

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Thu Apr 20 04:42:00 GMT 2000


>   > Wed Apr 19 12:54:31 MET DST 2000  Jan Hubicka  <jh@suse.cz>
>   > 	* calls.c (expand_call): Call compute_argument_block_size right
>   > 	before allocating the block; update comment; don't do alignment
>   > 	sanity checking for sibbling call; use args_size instead of
>   > 	unadjusted_args_size before args_size is adjusted.
> This patch is clearly wrong.
> 
> compute_argument_block_size modifies the data in args_size which needs to
> happen before the call to finalize_must_preallocate.
> 
> Please do _not_ install this patch.
Hi
I've just noticed what is wrong with that patch - I've made it in my modified
version of calls.c and then realized that the patch don't apply clearly, so
I've applied to the cvs version and regenerated.  Since calls.c in cvs is quite
different, I've (or the patch program) choosed wrong spot to place the
compute_argument_block. Now it is called to late after argument block is
preallocated.

So the patch broke every ACCUMULATE_OUTGOING_ARGS target with
REG_PARM_STACK_SPACE.  Here is updated patch with the call moved to the right
location. I expect this problem was causing the fold-cosnt.c lossage as well,
since size of preallocated block got wrong.

I am just finishing stage2 of bootstrap and everything seems to work for me.
Jeff - please can you try that patch for HP-PA?

I apologize for the inconvience.

Wed Apr 19 12:54:31 MET DST 2000  Jan Hubicka  <jh@suse.cz>
	* calls.c (expand_call): Call compute_argument_block_size right
	before allocating the block; update comment; don't do alignment
	sanity checking for sibbling call; use args_size instead of
	unadjusted_args_size before args_size is adjusted.
Index: egcs/gcc/calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.122
diff -c -3 -p -r1.122 calls.c
*** calls.c	2000/04/19 14:41:03	1.122
--- calls.c	2000/04/20 10:52:57
*************** expand_call (exp, target, ignore)
*** 2435,2453 ****
  	  sibcall_failure = 1;
  	}
  
-       /* Compute the actual size of the argument block required.  The variable
- 	 and constant sizes must be combined, the size may have to be rounded,
- 	 and there may be a minimum required size.  When generating a sibcall
- 	 pattern, do not round up, since we'll be re-using whatever space our
- 	 caller provided.  */
-       unadjusted_args_size
- 	= compute_argument_block_size (reg_parm_stack_space, &args_size,
- 				       (pass == 0 ? 0
- 					: preferred_stack_boundary));
- 
        /* If the callee pops its own arguments, then it must pop exactly
  	 the same number of arguments as the current function.  */
!       if (RETURN_POPS_ARGS (fndecl, funtype, unadjusted_args_size)
  	  != RETURN_POPS_ARGS (current_function_decl,
  			       TREE_TYPE (current_function_decl),
  			       current_function_args_size))
--- 2435,2443 ----
  	  sibcall_failure = 1;
  	}
  
        /* If the callee pops its own arguments, then it must pop exactly
  	 the same number of arguments as the current function.  */
!       if (RETURN_POPS_ARGS (fndecl, funtype, args_size.constant)
  	  != RETURN_POPS_ARGS (current_function_decl,
  			       TREE_TYPE (current_function_decl),
  			       current_function_args_size))
*************** expand_call (exp, target, ignore)
*** 2479,2484 ****
--- 2469,2484 ----
        if (flags & (ECF_CONST | ECF_PURE | ECF_MALLOC))
  	start_sequence ();
  
+       /* Compute the actual size of the argument block required.  The variable
+ 	 and constant sizes must be combined, the size may have to be rounded,
+ 	 and there may be a minimum required size.  When generating a sibcall
+ 	 pattern, do not round up, since we'll be re-using whatever space our
+ 	 caller provided.  */
+       unadjusted_args_size
+ 	= compute_argument_block_size (reg_parm_stack_space, &args_size,
+ 				       (pass == 0 ? 0
+ 					: preferred_stack_boundary));
+ 
        old_stack_allocated =  stack_pointer_delta - pending_stack_adjust;
  
        /* If we have no actual push instructions, or shouldn't use them,
*************** expand_call (exp, target, ignore)
*** 2601,2606 ****
--- 2601,2607 ----
  	    }
  	}
  
+ 
        /* The argument block when performing a sibling call is the
  	 incoming argument block.  */
        if (pass == 0)
*************** expand_call (exp, target, ignore)
*** 2807,2814 ****
  	 now!  */
  
  #ifdef PREFERRED_STACK_BOUNDARY
!       /* Stack must to be properly aligned now.  */
!       if (stack_pointer_delta & (preferred_stack_boundary / BITS_PER_UNIT - 1))
  	abort();
  #endif
  
--- 2808,2817 ----
  	 now!  */
  
  #ifdef PREFERRED_STACK_BOUNDARY
!       /* Stack must be properly aligned now.  */
!       if (pass &&
! 	  (stack_pointer_delta
! 	   & (preferred_stack_boundary / BITS_PER_UNIT - 1)))
  	abort();
  #endif
  
*************** emit_library_call_value_1 (retval, orgfu
*** 3712,3718 ****
  	    ? hard_libcall_value (outmode) : NULL_RTX);
  
  #ifdef PREFERRED_STACK_BOUNDARY
!   /* Stack must to be properly aligned now.  */
    if (stack_pointer_delta & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1))
      abort();
  #endif
--- 3715,3721 ----
  	    ? hard_libcall_value (outmode) : NULL_RTX);
  
  #ifdef PREFERRED_STACK_BOUNDARY
!   /* Stack must be properly aligned now.  */
    if (stack_pointer_delta & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1))
      abort();
  #endif


More information about the Gcc-patches mailing list