Strange warning (variable might be clobbered by `longjmp' or
Jeffrey A Law
law@hurl.cygnus.com
Tue Sep 2 19:15:00 GMT 1997
In message < 199709022224.PAA12532@cygnus.com >you write:
> of setjmp/longjmp. Unfortunately, this is done in a somewhat confusing way.
> It appears that the sequences for setjmp/longjmp are setting a pseudo to
> 0/1, and then branching to the same place which then branches off to the
> handler if this pseudo is 1. This just confuses the control flow. I have
> no idea why it is doing this, or whether my understanding is correct.
That is how setjmp/longjmp generally work.
When one calls setjmp it saves the state into a jmp_buf and returns zero.
When you longjmp control returns to the site of the setjmp; and the register
state is set up such that it appears that the setjmp call returned a second
time with a return value of one.
I don't know if it's relavent, but gcc knows that certain functions return
twice (setjmp, sigsetjmp, savectx, qsetjmp, etc etc). By emitting rtl
itself to perform the actions of setjmp/longjmp we may be defeating the
purpose of the code to determine that some calls may return twice.
Jeff
More information about the Gcc
mailing list