public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* RFA: Fix calculation of size of builtin setjmp buffer
@ 2014-05-06 12:55 Nick Clifton
  2014-05-06 13:15 ` Jakub Jelinek
  2014-05-14  8:17 ` Eric Botcazou
  0 siblings, 2 replies; 17+ messages in thread
From: Nick Clifton @ 2014-05-06 12:55 UTC (permalink / raw)
  To: gcc-patches

Hi Guys,

  There is a small bug in the computation for the size of the builtin
  setjmp buffer.  The size is based upon BITS_PER_WORD / POINTER_SIZE
  which for most targets equates to 1.  But for targets where pointers
  are larger than a word, it equates to zero.  This leads to stack
  corruption and all kinds of fun things.

  The patch is obvious - see below - but since it affects generic code
  and might have consequences which I have not foreseen, I thought it
  best to ask for approval first.

  No regressions with an x86_64-pc-linux toolchain, and quite a few G++
  testsuite fixes for an rl78-elf toolchain.

  OK to apply ?

Cheers
  Nick

2014-05-06  Nick Clifton  <nickc@redhat.com>

	* except.c (init_eh): Fix computation of builtin setjmp buffer
	size.

Index: gcc/except.c
===================================================================
--- gcc/except.c	(revision 210096)
+++ gcc/except.c	(working copy)
@@ -287,7 +287,7 @@
 #endif
 #else
       /* builtin_setjmp takes a pointer to 5 words.  */
-      tmp = size_int (5 * BITS_PER_WORD / POINTER_SIZE - 1);
+      tmp = size_int (5 * POINTER_SIZE / BITS_PER_WORD - 1);
 #endif
       tmp = build_index_type (tmp);
       tmp = build_array_type (ptr_type_node, tmp);

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-05-16 16:57 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-06 12:55 RFA: Fix calculation of size of builtin setjmp buffer 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
2014-05-16 16:57         ` Eric Botcazou

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).