longjmp()/setjmp() difference between gcc 3.3 (Apple) and gcc 3.4.x

Andrew Pinski pinskia@physics.uc.edu
Sun Jan 23 04:43:00 GMT 2005


On Jan 22, 2005, at 7:27 PM, Remy Martin wrote:

>
>> > setjmp() needs to be called only once, I think..
>>
>> Incorrect.  Once you leave the frame in which setjmp was called,
>> the contents of the jmpbuf become invalid.
>
> Hmm. This explains my observation on the counter variable, but the 
> (forced) jump itself is executed correctly. Can that be because 
> setjmp's frame was called in a loop doing hardly anything else, so 
> that the jmpbuf contents remained largely valid?
> Or can I take your remark to mean that if I call the function that 
> does the setjmp (contains the jump target) from my main(), the jmpbuf 
> will remain valid?

try compiling with -O1 -W -Wall and see what warnings you are getting.
But anyways, the variables which you want to keep must be marked 
violate.

-- Pinski



More information about the Gcc mailing list