Bug iwith setjmp/longjmp on Vax

rosen at gypsy.UUCP rosen at gypsy.UUCP
Fri Jun 7 06:19:00 AEST 1985


/*

This program was compiled under 4.2BSD on a VAX; it doesn't work the way it
should (I get a 'longjmp botch' message).  If I compile the same exact
program on a Sun running 4.2BSD it works fine.  I know that setjmp() and
longjmp() work on a Vax, but why is this simple program giving me a problem?

I've been told that this program is too simple for setjmp() and longjmp().
This appears to be true, because if I complicate the code just a bit, it
will work. What's going on?

*/


/* setjmp() - longjmp() test program */

#include <setjmp.h>

static jmp_buf env;
int mode;


main(){
	foo();
	longjmp(env, 1);
}

foo(){

  mode = setjmp(env);
  if (mode != 0) magic();
}

magic()
{
	printf("HERE I AM\n");
	exit(0);
}

/* End of code */

/*

Steve Rosen
Siemens Research and Technology Laboratories
Princeton, NJ

USENET: {ihnp4|princeton|adrvax}!siemens!rosen
ARPA:   princeton!siemens!rosen at TOPAZ

*/



More information about the Comp.unix.wizards mailing list