public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nicholas Clifton <nickc@redhat.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: RFA: Fix calculation of size of builtin setjmp buffer
Date: Fri, 16 May 2014 08:29:00 -0000	[thread overview]
Message-ID: <5375CC7B.7070202@redhat.com> (raw)
In-Reply-To: <2347976.UgdYmbUUr8@polaris>

Hi Eric,

   OK - here is your version of the patch, extended with a comment which 
I think is helpful for other people reading the code, and with the 
changes to builtins.c and md.texi removed, since the size of the buffer 
is not changing.

   Is this version OK to apply ?

Cheers
   Nick

gcc/ChangeLog
2014-05-16  Nick Clifton  <nickc@redhat.com>

	* except.c (init_eh): Correct computation of the size of a builtin
	setjmp buffer for when pointers are bigger than words.


Index: gcc/except.c
===================================================================
--- gcc/except.c	(revision 210490)
+++ gcc/except.c	(working copy)
@@ -286,9 +286,22 @@
        tmp = size_int (FIRST_PSEUDO_REGISTER + 2 - 1);
  #endif
  #else
-      /* builtin_setjmp takes a pointer to 5 words.  */
-      tmp = size_int (5 * BITS_PER_WORD / POINTER_SIZE - 1);
+      /* Compute a minimally sized jump buffer.  We need room to store at
+	 least 3 pointers - stack pointer, frame pointer and return address.
+	 Plus for some targets we need room for an extra pointer - in the
+	 case of MIPS this is the global pointer.  This makes a total of four
+	 pointers, but to be safe we actually allocate room for 5.
+
+	 If pointers are smaller than words then we allocate enough room for
+	 5 words, just in case the backend needs this much room.  For more
+	 discussion on this issue see:
+	 http://gcc.gnu.org/ml/gcc-patches/2014-05/msg00313.html.  */
+      if (POINTER_SIZE > BITS_PER_WORD)
+	tmp = size_int (5 - 1);
+      else
+	tmp = size_int ((5 * BITS_PER_WORD / POINTER_SIZE) - 1);
  #endif
        tmp = build_index_type (tmp);
        tmp = build_array_type (ptr_type_node, tmp);


  parent reply	other threads:[~2014-05-16  8:29 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 12:55 Nick Clifton
2014-05-06 13:15 ` Jakub Jelinek
2014-05-06 14:34   ` Nicholas Clifton
2014-05-06 14:38     ` Richard Biener
2014-05-06 14:40     ` Jakub Jelinek
2014-05-06 15:07       ` Nicholas Clifton
2014-05-06 20:17         ` Mike Stump
2014-05-08 14:25           ` Nicholas Clifton
2014-05-08 16:08             ` Mike Stump
2014-05-14  8:23               ` Eric Botcazou
2014-05-14  8:17 ` Eric Botcazou
2014-05-14 13:32   ` Nicholas Clifton
2014-05-15  7:56     ` Eric Botcazou
2014-05-15 14:49       ` Mike Stump
2014-05-16 16:56         ` Eric Botcazou
2014-05-16  8:29       ` Nicholas Clifton [this message]
2014-05-16 16:57         ` Eric Botcazou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5375CC7B.7070202@redhat.com \
    --to=nickc@redhat.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).