Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!gem.mps.ohio-state.edu!apple!sun-barr!newstop!sun!chiba!khb
From: khb%chiba@Sun.COM (chiba)
Newsgroups: comp.lang.fortran
Subject: Re: Is this valid fortran
Message-ID: <125715@sun.Eng.Sun.COM>
Date: 3 Oct 89 23:06:30 GMT
References: 
Sender: news@sun.Eng.Sun.COM
Reply-To: khb@sun.UUCP (chiba)
Organization: Sun Microsystems, Mountain View
Lines: 35

In article  mikem+@andrew.cmu.edu (Michael Meyer) writes:
>Hi:
>Could someone please tell me if the following function is valid fortran?
> The code does compile (but produced execution errors) on the Decstation
>3100.  
>	complex function fred(x,y)
>	complex x,y
>	fred=(10,10)
>	fred= x*conjg(y) + fred
>	return
>	end
>
>My question is whether it is allowable to treat the function name (fred)
>as a variable in the body of the function.  Is is allowable to update
>the value of fred?

Page 15-7 of 3.9-1978

"...the symbolic name of a function subprogram or an associated entry
name of the same type _must_ (emphasis added) appear as a variable
name in the function subprogram. During every execution of the
external function, this variable must become defined and, once
defined, may be referenced or become redefined ..."

So your code is legal. If memory serves, DEC (via MIPS :>) supports
recursive calls, and does it as the default case ... perhaps the fred
= f(x) + fred is incidentally calling itself or something equally
evil.

This sort of thing is often broken in compilers; so some folks prefer
to limit their exposure by using temporaries.
Keith H. Bierman    |*My thoughts are my own. !! kbierman@sun.com
It's Not My Fault   |	MTS --Only my work belongs to Sun* 
I Voted for Bill &  | Advanced Languages/Floating Point Group            
Opus                | "When the going gets Weird .. the Weird turn PRO"