Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site cheviot.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!mcvax!ukc!cheviot!robert From: robert@cheviot.UUCP (Robert Stroud) Newsgroups: net.lang Subject: Re: Smart compilers Message-ID: <236@cheviot.UUCP> Date: Fri, 18-Jan-85 11:17:26 EST Article-I.D.: cheviot.236 Posted: Fri Jan 18 11:17:26 1985 Date-Received: Mon, 21-Jan-85 01:12:13 EST References: <206@cheviot.UUCP> <409@petsd.UUCP> Reply-To: robert@cheviot.UUCP (Robert Stroud) Organization: U. of Newcastle upon Tyne, U.K. Lines: 56 Summary: In article <206@cheviot.UUCP> robert@cheviot.UUCP (that's me!) wrote: > 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?? Judging by a couple of responses to this, I didn't make myself clear for which I apologise. I was not suggesting writing another version of SQRT with the same name but an eccentric behaviour, but asking how an optimising compiler would cope if the code was identical except that instead of calling SQRT the programmer called an arbitrary function of his own about which the compiler knew nothing. My second example, aliassing Y onto X(3), would fail with a completely standard SQRT function in any case, because Y would no longer be a loop invariant. However, getting away from the nitty-gritty of particular pathological cases I was really trying to make a more general point. It would seem from other discussions that examples like mine are banned by the small print of the language standard. The problem is that such deviations are very hard if not impossible to detect by a conventional compiler which is therefore at liberty to do what it likes with "non-standard" code. Perhaps because I am a European (:-) I worry about this. If it is possible to write a non-standard program by accident which is incorrectly optimised by a compiler which conforms to the standard, then we have a potentially dangerous situation on our hands. Suppose this program is let loose on some application where lives are at risk? Even if the application is not that critical, a lot of time and money could be wasted tracking down something which is not really a compiler bug. Whether this will be a problem or not depends on how easy it is to write a non-standard program by accident, and whether such things are rare anyway. It would presumably be possible to write something like "lint" only more so which crawled all over a large program looking for deviations from the standard that an ordinary compiler would have neither the time nor the inclination to discover. Any opinions on this? I don't see why the discussion should be restricted to Fortran. Probably the only way of eliminating aliases and such-like altogether would be to program in a purely functional language without assignment or side-effects. Robert Stroud, Computing Laboratory, University of Newcastle upon Tyne ARPA robert%cheviot%newcastle.mailnet@mit-multics UUCP ...!ukc!cheviot!robert