robert@acad.UUCP (Robert Wenig ext 609) (05/25/87)
I have found that setjmp does not work correctly if the module in which the call was contained was compiled with OPTIMIZE on. Has anyone else encountered similar problems? Robert Wenig Autodesk
murphy@hao.UCAR.EDU (Graham Murphy) (05/25/87)
In article <121@acad.UUCP> robert@acad.UUCP (Robert Wenig ext 609) writes: > >I have found that setjmp does not work correctly if the module in which >the call was contained was compiled with OPTIMIZE on. Has anyone else >encountered similar problems? > > >Robert Wenig >Autodesk I assume by "does not work" you have found that some variables don't retain their expected values when you return to the routine. This is because the longjmp restores ALL the registers, which means any variables that have been optimized into these registers will take on the values they had when the setjmp call was made. Can be tricky as it is not always obvious when this will happen (except with hindsight.) In all other respects I have had no problems with setjmp/longjmp having used it in many optimized routines. Graham Murphy High Altitude Observatory National Center for Atmospheric Research -- UUCP: {hplabs, seismo, nbires, noao}!hao!murphy CSNET: murphy@ncar.csnet ARPA: murphy%ncar@CSNET-RELAY.ARPA INTERNET: murphy@hao.ucar.edu NOT-NET: P.O. Box 3000, Boulder, CO 80307-3000. (303) 497-1514.