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]

Fix sibcall memory trample.


All

On an internal port I experienced a failures to build some
parts of the libraries which I tracked down to the call to
SET_BIT in calls.c:check_sibcall_argument_overlap which was
setting bits beyond the end of the allocated stored_args_map
sbitmap. 

The problem is not enough space was allocated for the
stored_args_map sbitmap because the args_size was not
cacluated correctly.

The cause is in function.c:locate_and_pad_parm which calls
calls to pad_below aligns parameters on PARAM_BOUNDARY but
this extra padding was not reflected on the size of the final
argument list.

Here's the patch to fix the bug.

bootstrapped on mips-elf, arm-elf and i686-pc-linux-gnu

ChangeLog

	* function.c (locate_and_pad_parm): Also pad initial offset
	so that the total argument size also includes the padding.

-------------------------------------------------------------
Index: function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.283
diff -c -p -r1.283 function.c
*** function.c  2001/07/11 20:35:51     1.283
--- function.c  2001/07/25 15:38:00
*************** locate_and_pad_parm (passed_mode, type,
*** 5264,5270 ****
      /* However, BLKmode args passed in regs have their padding done elsewhere.
         The stack slot must be able to hold the entire register.  */
        && !(in_regs && passed_mode == BLKmode))
!     pad_below (offset_ptr, passed_mode, sizetree);

    if (where_pad != none
        && (!host_integerp (sizetree, 1)
--- 5264,5273 ----
      /* However, BLKmode args passed in regs have their padding done elsewhere.
         The stack slot must be able to hold the entire register.  */
        && !(in_regs && passed_mode == BLKmode))
!     {
!       pad_below (offset_ptr, passed_mode, sizetree);
!       pad_below (initial_offset_ptr, passed_mode, sizetree);
!     }

    if (where_pad != none
        && (!host_integerp (sizetree, 1)
-------------------------------------------------------------


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