C++ Exception handling

Nick Burrett nick at dsvr.net
Tue Mar 2 11:57:34 PST 2004


Peter Naulls wrote:

> 
> Graham Shaw has found a fix for exception handling issues in GCC 2.95.4.
> I don't know if they also apply to 3.3.3, but I've quoted the relevant
> parts and the patch:

>>(The code certainly looks wrong.  It says that the jump buffer starts two
>>words into the area allocated, but the requested size is
>>GET_MODE_SIZE(Pmode)*(size+1).)
>>
>>Really this needs to be checked by someone who knows a bit more about the
>>internals of GCC than I do.  On the upside, I can't see my patch doing
>>much harm (except for slightly increasing run-time memory usage) and it
>>does seem to work.
> 
> 
> diff -ur gccsdk/gcc/gcc/except.c gccsdk-295/gcc/gcc/except.c
> --- gccsdk/gcc/gcc/except.c	Thu Feb 26 08:16:48 2004
> +++ gccsdk-295/gcc/gcc/except.c	Thu Feb 26 08:14:25 2004
> @@ -1363,7 +1363,7 @@
>       but there is no allocation routine that allocates at the level of
>       the last binding contour.  */
>    arg = assign_stack_local (BLKmode,
> -			    GET_MODE_SIZE (Pmode)*(size+2),
> +			    GET_MODE_SIZE (Pmode)*(size+1),
>  			    0);
>  
>    arg = change_address (arg, Pmode, NULL_RTX);
> 

I'm a little confused.  The code in the copy of gccsdk-2.95 in my CVS 
tree is shown below.  The file hasn't been changed since 12 Sep 2001.

  /* XXX, FIXME: The stack space allocated this way is too long lived,
     but there is no allocation routine that allocates at the level of
     the last binding contour.  */
  arg = assign_stack_local (BLKmode,
			    GET_MODE_SIZE (Pmode)*(size+1),
			    0);


Where 'size+2' comes from, I really don't know.


Nick.








More information about the gcc mailing list