James Giles wrote:
>
> Walt Brainerd <[log in to unmask]> wrote:
> ...
> >Does anybody think a compiler should not be allowed to do
> >the kinds of optimizations we have been talking about:
> >moving invariant code out of loops, removing "dead" code,
> >inlining procedures, combining expressions in more than
> >one statement (Interp #1?) etc?
>
> Well, yes and no. If doing any of these things changes the standard's
> specified semantics of the program, then they shouldn't be allowed.
> If they change the meaning, but with respect to something not
> covered by the standard, it's a gray area.
>
> For example, the code given earlier:
>
> T = B+C
> D = A * T
> However, if all the variables except T are declared double precision
> and T is declared default real, I believe the optimization should not be
> allowed. Instead, you should be required to do something like:
>
> D = C * REAL(A+B, kind(0.0))
Sure, I would consider this the "equivalent thing".
Of course, this runs into that precision area again, where things
also are very muddy.
--
Walt Brainerd [log in to unmask]
Unicomp, Inc. +1-520-298-7212 298-7074 (fax)
7660 E. Broadway, Suite 308 888-330-6060
Tucson, AZ 85710 USA http://www.uni-comp.com
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|