Path: utzoo!attcan!uunet!lll-winken!sun-barr!newstop!sun!amdahl!key!sjc From: sjc@key.COM (Steve Correll) Newsgroups: comp.lang.fortran Subject: Re: Function calls in the middle of subroutine CALLs? -- Is it standard fortran 77 ???? Message-ID: <2009@key.COM> Date: 26 Jul 90 02:43:57 GMT References: <57505@lanl.gov> Organization: Key Computer Labs, Fremont, CA Lines: 24 In article , burley@world.std.com (James C Burley) writes: > ...It > seems to me the spirit, if not the letter, of the F77 standard in this area > was to say "the compiler can avoid making function calls if it can determine, > by simply looking at only the program unit being compiled, that they are not > needed at compile or run time". Now if a compiler looks at more than one > program unit at a time (truly global optimization) and decides to eliminate > function calls, then IMHO it must still perform any side effects coded for > that function unless it determines that they, too, can be eliminated on a > global basis. The F77 standard explicitly says the processor may omit to evaluate a function reference if it doesn't need to know the return value, and that any entities that would ordinarily have become defined by "side effects" instead become undefined. See section 6.6.1, page 6-16 of ANSI X3.9-1978. The example in the standard is: X .GT. Y .OR. L(Z) where L is a logical function which defines its dummy argument. The standard says that if X is greater than Y, then Z becomes undefined. Not very user- friendly, but Fortran programmers have traditionally been tough as nails. -- ...{sun,pyramid}!pacbell!key!sjc Steve Correll