[comp.sys.apollo] ftn 10.7 and f77 - problem

moss_r@summer.chem.su.oz.au (Richard Moss) (04/09/91)

I know the latest craze is finding bugs with ftn 10.8, but I've found a problem
using
ftn 10.7, or at least the f77 front end to it...


For the last few weeks I have been writing a fairly long monte carlo particle 
simulation code.  After getting rid of all the bugs, I tried compiling it with 
f77 and ftn option -opt 4.

It no longer worked !

With no optimization and -dba everything was fine.  Above -opt 2 the program
just
didn't work properly.

I was using "f77 -W0,-opt 4".  If I used "f77 -W0,-opt 4,-xrs" instead
everything was 
fine and dandy again. 

Using /usr/apollo/lib/ftn by hand ( without -xrs ) also worked fine.

What does f77 do that stuffs up the higher optimisation levels ?  

thanks
            Richard Moss
            dep't theoretical chemistry, Sydney University
            moss_r@summer.chem.su.oz.au

system@alchemy.chem.utoronto.ca (System Admin (Mike Peterson)) (04/10/91)

In article <1991Apr9.043538.4195@metro.ucc.su.OZ.AU> moss_r@summer.chem.su.oz.au (Richard Moss) writes:
>I was using "f77 -W0,-opt 4".  If I used "f77 -W0,-opt 4,-xrs" instead
>everything was fine and dandy again. 

I am assuming you actually did
     f77 "-W0,-opt 4,-xrs"
or something else to quote the blank in the option (otherwise f77 won't
see the '-opt 4' but sees '-opt' which defaults to '-opt 3').

>Using /usr/apollo/lib/ftn by hand ( without -xrs ) also worked fine.

According to the manual, 'xrs' is the default so it shouldn't matter.
What 'opt' did you specify and how?

>What does f77 do that stuffs up the higher optimisation levels ?  

See your manual, pp. 6-22 to 6-32. We have found some problems with 
'-opt 3' but most programs that fail do so at compile time with "backend
failures" (unless the program uses complex variables, when it will
probably compile but give wrong results at -O). We don't bother with
'-opt 4' except in special cases, since more programs give wrong answers
and we don't see much speedup on general (usually sloppy :-)) codes.

At 10.8, '-opt 4' or '-O4' can in-line your subroutines for better
optimization.
-- 
Mike Peterson, System Administrator, U/Toronto Department of Chemistry
E-mail: system@alchemy.chem.utoronto.ca
Tel: (416) 978-7094                  Fax: (416) 978-8775