Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site watdaisy.UUCP
Path: utzoo!watmath!watdaisy!ndiamond
From: ndiamond@watdaisy.UUCP (Norman Diamond)
Newsgroups: net.unix-wizards,net.lang
Subject: Re:  smart compilers
Message-ID: <6831@watdaisy.UUCP>
Date: Thu, 20-Dec-84 11:18:53 EST
Article-I.D.: watdaisy.6831
Posted: Thu Dec 20 11:18:53 1984
Date-Received: Fri, 21-Dec-84 01:17:39 EST
References: <6599@brl-tgr.ARPA> <979@opus.UUCP>
Organization: U of Waterloo, Ontario
Lines: 35
Xref: watmath net.unix-wizards:11157 net.lang:1149

> >  Optimizing compilers are very useful
> >  as long as the optimization is optional (or at least can be turned
> >  off when the code involved may be sensitive to optimization).
> 
> Not quite fair to compilers.  If optimizing breaks programs which conform
> to the language definition, the optimizer is broken.  If optimizing breaks
> a program because the program is non-conforming (as, say, a program which
> depends on order of evaluation in most languages), the program is at fault.
> Using C assignments to manipulate or busy-wait on device registers is a
> gray area, which is why (1) optimizers zing people on such code
> periodically and (2) a mechanism like `volatile' has been proposed.
> 
> FORTRAN is less susceptible to clashes with the optimizer due to the
> device-register sort of hassle but more susceptible to poor programming
> such as parameter/COMMON aliasing, misunderstanding of modifying
> initialized COMMON, etc.

It is usually necessary for optimizations to break certain obscure points
that conform to the language definition, e.g. which order STATEMENTS are
executed in so that code can be moved out of loops.  Many useful optimizations
cannot be done when more than 99.9% of the language definition must be
respected.

In turn, this is the reason that optimizations must be optional.

And if these optimizations were not available, clamouring might start for a
return to assembly languages.

-- Norman Diamond

UUCP:  {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond
CSNET: ndiamond%watdaisy@waterloo.csnet
ARPA:  ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa

"Opinions are those of the keyboard, and do not reflect on me or higher-ups."