Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: Should optimizing compilers automatically assign registers? Message-ID: <3321@auspex.auspex.com> Date: 8 May 90 17:53:34 GMT References: <512@hhb.UUCP> <596@atcmpe.atcmp.nl> Organization: Auspex Systems, Santa Clara Lines: 18 >Should an optimizer put autovar's in a register anyway? Yes, it should. >If you use setjmp/longjmp, on the return from setjmp via longjmp, automatic >variables can not be trusted any more! If they are not in a register >everything is fine, but else the reg-var's are overwritten with registervalues >which were there at the time of the longjmp call. ANSI C says that unless you declare the automatic variables "volatile", there's no guarantee that "setjmp"/"longjmp" will preserve them. Sun's C compiler includes a #pragma "makes_regs_inconsistent", and on the 68K-based Suns includes this #pragma when you include ; that #pragma suppresses the automatic register allocation in routines that call the routines listed in the #pragma, and in the version used when you include , "sigsetjmp", "setjmp", and "_setjmp" are listed.