[comp.sys.sgi] f77 optimization

gravishanker@eagle.wesleyan.edu (03/29/91)

Hi

I have a general question on using any of the Optimization options for f77
on SG Irises. We have several programs used for molecular modelling that were
written in old Fortran IV style and they all work great with -O option and work
fine. We also have some recent programs written to run on a VAX. Strangley most
of these programs do not run correctly if -O is used and the only way they can
be made to behave the same way as on a VAX is to use -g. We know that these
programs mostly assume that the variables local to subroutines are saved and
used in subsequent calls, a property that is the default in VAX/FORTRAN. We use
-static option to emulate this on our Irises along with -O, but no luck. 

We have not seriously worried about optimizing these programs because they run
fast anyway. However, we are at a point now where we want to look into why is
this happening. When we called the SG hotline, after various questions the
person wanted to see our code. These programs have several hundred lines of
code and it is not going to help much. What I would like to know is if there
are any general troubleshooting guidelines one can follow to locate the
problems. Also, if there are others who convert their VAX/FORTRAN programs over
to the Irises who have encountered similar problems and have found out
solutions. Thanks in advance for any help.

Ravi

rosalia@max.physics.sunysb.edu (Mark Galassi) (04/03/91)

In article <1991Mar28.220805.40858@eagle.wesleyan.edu> gravishanker@eagle.wesleyan.edu writes:
>of these programs do not run correctly if -O is used and the only way they can
>be made to behave the same way as on a VAX is to use -g. We know that these

You don't have to use -g.  That really slows things down.  You can use
-O0 to avoid all optimization and still not include all the debugging stuff.

One of our users here had exactly the same problem, but with a rather
short program, so he bugged sgi until they conceded him a bug #.  They
have not yet sent us a fix after a couple of months, though.  I guess we
will have to call them up.

Meanwhile, and this might be relevant, our MIPS computer (same chip, same
compilers) got an upgrade, and the release notes point out several fixes
in the f77 optimizer.  One of them looked like this:

#187 (or something) Serious.  Wrong results in addition using f77 optimizer.

That's a pretty bad error, what?  SGI should really send out the same
upgrade, or whatever it is that they do with new versions they get
from MIPS.

-- 
    {These opinions are mine, and should be everybody else's :-)}
	Mark Galassi		rosalia@dirac.physics.sunysb.edu
				rosalia@sunysbnp.BITNET