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]
Other format: [Raw text]

Re: RFA: Fix calculation of size of builtin setjmp buffer


On May 6, 2014, at 8:07 AM, Nicholas Clifton <nickc@redhat.com> wrote:
> +      tmp = size_int ((5 * MAX (POINTER_SIZE, BITS_PER_WORD)) / BITS_PER_WORD - 1);

This is not right.  The denominator should either be GET_MODE_SIZE (Pmode) or POINTER_SIZE.  See get_nl_goto_field for additional fun.

Also, the save area for the machine is exactly 2 * GET_MODE_SIZE (Pmode) in and the save area is exactly GET_MODE_SIZE (STACK_SAVEAREA_MODE (SAVE_NONLOCAL)) bits.  builtin_setjmp_setup is the only unaccounted for component.

mips is alone in having slop not accounted for in GET_MODE_SIZE (STACK_SAVEAREA_MODE (SAVE_NONLOCAL)).  Personally, I’d rather make the size calculation exact, rather than even more sloppy and hard to comprehend.

How about GET_MODE_SIZE (STACK_SAVEAREA_MODE (SAVE_NONLOCAL)) / GET_MODE_SIZE (Pmode) + 2 + /* slop for mips, see builtin_setjmp_setup */ 1 - 1.  This retains the slop for mips, and fixes ports like ia64 and s390 (see STACK_SAVEAREA_MODE on those ports, it is larger one might expect)?

Last patch that `broke’ this:

  http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02000.html

That entire thread is interesting.

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