Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] exceptions.h: Fix definition of TRY_CATCH
Date: Wed, 09 Mar 2005 17:40:00 -0000	[thread overview]
Message-ID: <20050309174015.GA17510@nevyn.them.org> (raw)
In-Reply-To: <20050309164803.GN2839@cygbert.vinschen.de>

On Wed, Mar 09, 2005 at 05:48:03PM +0100, Corinna Vinschen wrote:
> If you inspect it, you'll see that the first parameter `env' is evaluated
> three times.  Since the first parameter is a call to the function
> exceptions_state_mc_init(), the result is that three new catcher structures
> are created.  But only one of them, the last one which has been created,
> is correctly iniitialized by the call to exceptions_state_mc_action_iter(). 
> I guess you see what will happen at one point.  A non-initialized catcher
> is current when the function exceptions_state_mc_action_iter_1() is called
> ==> internal_error.
> 
> Note that this is *not* a flaw in newlib or Cygwin.  It's perfectly fine
> that setjmp and sigsetjmp are defined as macros as above, see
> http://www.opengroup.org/onlinepubs/009695399/functions/setjmp.html and
> http://www.opengroup.org/onlinepubs/009695399/functions/sigsetjmp.html,
> so the usual macro expansion restrictions apply.
> 
> Conclusion:  The actual problem is that the sigjmp_buf is created in a
> function call which is the first parameter to sigsetjmp.

Nice catch!

> Solution: Don't do it. :-)
> 
> A patch is below.  Tested on Cygwin and Linux.
> 
> 
> Ok to check in?
> 
> 
> Corinna
> 
> 
> 	* exceptions.h (TRY_CATCH): Define setjmp/sigsetjmp macro save.

Yes, this is OK (save -> safe in the changelog).

-- 
Daniel Jacobowitz
CodeSourcery, LLC


  reply	other threads:[~2005-03-09 17:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-09 16:48 Corinna Vinschen
2005-03-09 17:40 ` Daniel Jacobowitz [this message]
2005-03-09 17:54   ` Corinna Vinschen

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=20050309174015.GA17510@nevyn.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /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