[comp.arch] Correct? programs

hrubin@pop.stat.purdue.edu (Herman Rubin) (06/25/91)

In article <1991Jun24.211407.17389@ingres.Ingres.COM>, jpk@Ingres.COM (Jon Krueger) writes:
> jbs@WATSON.IBM.COM (James B. Shearer) writes:
> > Do you disagree that it is undesirable for optimization to affect
> > a program's behavior?
> 
> Yes.
> 
> It is a good and joyful thing, always and everywhere, for
> compilers to expose broken programs.
> 
> Correct programs can be written in available languages.
> The meaning of such programs does not depend on whether
> compilers apply permissible optimizations.

It is almost possible to write absolutely correct programs, but is it
worthwhile?  It is easy to give examples where the slightest breathing
at a program will give different answers.  

One is always going to have problems with architectural limits, such as
number of bits of precision, exponent range, how overflow and underflow
are handled, etc.  Cancellation can be a problem, and sometimes a careful
rearrangement of the calculation, supposedly violating optimization rules,
can avoid the problem.  Only by using obscure languages do we have the
availability needed for even producing reasonable programs.

 
-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399
Phone: (317)494-6054
hrubin@l.cc.purdue.edu (Internet, bitnet)   {purdue,pur-ee}!l.cc!hrubin(UUCP)