Path: utzoo!news-server.csri.toronto.edu!rutgers!att!pacbell.com!decwrl!olivea!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.os.minix Subject: Re: A patch to make gcc 1.39 work with Minix setjmp Message-ID: <4314@skye.ed.ac.uk> Date: 13 Mar 91 19:20:46 GMT References: <1991Mar10.223859.380@santra.uucp> <1991Mar12.225635.29426@cbnewsc.att.com> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 21 In article <1991Mar12.225635.29426@cbnewsc.att.com> ladd@cbnewsc.att.com (david.ladd) writes: > * All automatic variables not declared `register' are > preserved by `longjmp'. Ordinarily, GNU C follows ANSI C: > automatic variables not declared `volatile' may be clobbered. This has nothing to do with the problem. If "-traditional" is set, in a function that calls setjmp(), gcc only puts into registers those variables declared "register". Normally, it ignores register declarations and puts whatever variables it feels like in registers. The real problem is that the Minix setjmp() only saves those registers that the Minix compiler needs saved. If you use gcc, you need a setjmp() that saves the registers that gcc needs saved. The simplest solution is to save all the registers. This means that setjmp() is good for all compilers (and for assembler too). -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin