Problems with -fstack-check on some system

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Mon Jan 22 11:01:00 GMT 2001


If a system has a stack_check_libfunc and pointers whose size is not the
word size, we may get an ICE in probe_stack_range.  Here's the fix:

Mon Jan 22 13:59:09 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* explow.c (probe_stack_range): Ensure value passed to
	stack_check_libfunc is ptr_mode, not Pmode.

*** explow.c	2001/01/01 14:04:25	1.55
--- explow.c	2001/01/22 18:57:09
*************** probe_stack_range (first, size)
*** 1559,1568 ****
       check the stack.  */
    if (stack_check_libfunc != 0)
!     emit_library_call (stack_check_libfunc, 0, VOIDmode, 1,
! 		       memory_address (QImode,
! 				       gen_rtx (STACK_GROW_OP, Pmode,
! 						stack_pointer_rtx,
! 						plus_constant (size, first))),
! 		       ptr_mode);
  
    /* Next see if we have an insn to check the stack.  Use it if so.  */
--- 1559,1576 ----
       check the stack.  */
    if (stack_check_libfunc != 0)
!     {
!       rtx addr = memory_address (QImode,
! 				 gen_rtx (STACK_GROW_OP, Pmode,
! 					  stack_pointer_rtx,
! 					  plus_constant (size, first)));
! 
! #ifdef POINTERS_EXTEND_UNSIGNED
!       if (GET_MODE (addr) != ptr_mode)
! 	addr = convert_memory_address (ptr_mode, addr);
! #endif
! 
!       emit_library_call (stack_check_libfunc, 0, VOIDmode, 1, addr,
! 			 ptr_mode);
!     }
  
    /* Next see if we have an insn to check the stack.  Use it if so.  */


More information about the Gcc-patches mailing list