Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site petsd.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!vax135!petsd!joe From: joe@petsd.UUCP (Joe Orost) Newsgroups: net.lang Subject: Re: Smart compilers Message-ID: <409@petsd.UUCP> Date: Mon, 14-Jan-85 22:14:14 EST Article-I.D.: petsd.409 Posted: Mon Jan 14 22:14:14 1985 Date-Received: Tue, 15-Jan-85 05:45:30 EST References: <206@cheviot.UUCP> Reply-To: joe@petsd.UUCP (Joseph M. Orost) Organization: Perkin-Elmer DSG, Tinton Falls, N.J. Lines: 30 Summary: In article <206@cheviot.UUCP> robert@cheviot.UUCP (Robert Stroud) writes: >There has been a lot of discussion recently about how to optimise >the Fortran program, > > DO 100 I=1,10 > IF (Y .GT. 0) X(I) = SQRT(Y) > 100 CONTINUE > >Most of the suggestions have been wrong, and even those that are right >would not work in the presence of certain pathological cases of aliassing >and side-effects. For example, suppose SQRT was a user function which >modified the COMMON block variable I as a side-effect. Or suppose, SQRT >gave a negative result and Y was EQUIVALENCE'd onto X(3). Could even >a really good data flow analyser cope with such pathologies and would it >be reasonable to expect it to be able to cope?? No, SQRT cannot be a user function unless it is declared as "EXTERNAL". Our compiler uses this info to keep a list of functions that are "optimizable", that is they have no side effects and return the same result for the same argument. regards, joe -- Full-Name: Joseph M. Orost UUCP: ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe US Mail: MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724 Phone: (201) 870-5844 Location: 40 19'49" N / 74 04'37" W