Bug iwith setjmp/longjmp on Vax

Wayne A. Christopher faustus at ucbcad.UUCP
Sun Jun 9 18:14:47 AEST 1985


> main(){
> 	foo();
> 	longjmp(env, 1);
> }
> 
> foo(){
> 
>   mode = setjmp(env);
>   if (mode != 0) magic();
> }

I think the problem is that you can only longjmp back to somewhere below
where you are on the stack. It resets things like the stack and argument
pointers, and if you have already returned from the routine where you
did the setjmp, you will have problems... I don't know exactly how this
would work, but this is certainly not an intended use of longjmp...

	Wayne



More information about the Comp.unix.wizards mailing list