This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Fix calculation of size of builtin setjmp buffer
- From: Mike Stump <mikestump at comcast dot net>
- To: Nicholas Clifton <nickc at redhat dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 6 May 2014 13:17:06 -0700
- Subject: Re: RFA: Fix calculation of size of builtin setjmp buffer
- Authentication-results: sourceware.org; auth=none
- References: <87wqdzjccp dot fsf at redhat dot com> <20140506131536 dot GV1817 at tucnak dot redhat dot com> <5368F2FD dot 9080604 at redhat dot com> <20140506144026 dot GX1817 at tucnak dot redhat dot com> <5368FAA9 dot 1030304 at redhat dot com>
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.