Re: Function PRESENT and logical combinations

From: Richard Maine (nospam_at_see.signature)
Date: 06/17/04


Date: 16 Jun 2004 15:29:54 -0700


"James Giles" <jamesgiles@worldnet.att.net> writes:

> Implementations do not push common-expression
> analysis through functions (or subroutines).

Probably true of most implementations and most situations,
but I'm quite sure that I have seen reports (probably even here
in clf) of problems with constructs like

  do i = 1 , 100
    x(i) = some_random_number_generator_function()
  end do

I suppose that counts as loop invariant instead of a common
subexpression, but its a similar idea.

So I guess that, as usual, I disagree with the statement in
its unqualified form, even though I agree that it is usually
accurate.

> Of course, for
> non-PURE functions, the compiler must prove even more: that
> the procedure itself has no side-effects that have further consequences
> in the program.

I was tempted to quote the exact words of the official f77
interpretation that I think contradict the above "must" in words that
I couldn't imagine being any more explicit. I even opened up the
document to the relevant page to copy them, but then I remembered
that, oh yes, last time I cited exactly those words, Giles interpreted
them differently than I did; I think he even found at least some
others here agreeing with his reading, which I guess just shows the
inadequacy of my previous imagination. So I'll just leave it as
"this too is a point of debate".

I really should just announce a global pre-reply, since these
statements keep getting made without the qualifier, that every time
someone says "must" or equivalent words, an implicit "in my
[the poster's] opinion" should be added...

at least in my opinion. :-)

-- 
Richard Maine                       |  Good judgment comes from experience;
email: my first.last at org.domain  |  experience comes from bad judgment.
org: nasa, domain: gov              |        -- Mark Twain