Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!kunivv1!atcmpe!leo From: leo@atcmp.nl (Leo Willems) Newsgroups: comp.unix.wizards Subject: Re: Should optimizing compilers automatically assign registers? Message-ID: <596@atcmpe.atcmp.nl> Date: 7 May 90 19:53:11 GMT References: <512@hhb.UUCP> Organization: AT Computing, Nijmegen, The Netherlands Lines: 45 From article <512@hhb.UUCP>, by istvan@hhb.UUCP (Istvan Mohos): > > program deleted > > Prog1 and prog2 are identical except that prog1 requests the > assignment of the auto variable p to a hardware register. and prog2 not. > I mistakenly assumed that by using the -O flag, the compiler > would optimize prog2, and generate identical objects from etc. > > Is the automatic allocation of a few variables into registers > too much to ask from an optimizing compiler? Sorry for the rude deletion of text. Our compiler with -O is putting automatic variables in registers. (3b2 SV 3.1) But I have a question on this subject: Should an optimizer put autovar's in a register anyway? 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. This is in conflict with the manual page of setjmp/longjmp. (I realise the setjmp/longjmp implementation is not very portable, but their behaviour should be) Is there an answer to this problem? (besides of not using setjmp/longjmp:-( ) Thanks Leo Willems Internet: leo@atcmp.nl AT Computing UUCP: mcvax!hp4nl!kunivv1!atcmpe!leo P. O. Box 1428 6501 BK Nijmegen Phone: +31-80-566880 The Netherlands Fax: +31-80-555887