gfortran equivalent to -r8

Rob McDonald rob.a.mcdonald@gmail.com
Thu Nov 17 18:16:00 GMT 2016


I have a legacy program that builds and runs correctly with -r8 on
g95.  What flags do I need to build it on gfortran?  I'd like to get
it going on gfortran as it is so much more widely available these
days.


I'm working with a program that I don't know the last time it was
compiled - by whom - or on what.  It isn't huge (about 2500 lines),
but I would rather not re-write the whole thing or go through it
line-by-line.

The bundled Makefile includes instructions for SGI f77 and Linux
ifort.  No dates or version numbers are provided/implied.  Both of
those targets build with '-r8 -g' flags.

I'm using compilers as provided by MacPorts.  The g95 is 0.93 based on
gcc 4.2.4.  The gfortran is 6.1.0.

Building with 'g95 -r8 -g' produces a program that appears to run
correctly and produce reasonable results for a wide variety of test
cases.

Building with 'g95' and no other options produces a program that does
not terminate.

Building with 'gfortran' and various combinations of -fdefault-real-8
(double, integer) produce programs that run, but do not give the
expected results.  Not just precision differences -- the program
behaves in very different ways (takes different branches, etc).  The
gfortran builds also complain about floating-point exceptions
signaling.

What compiler options best get gfortran to behave like other compilers
with the -r8 flag?

Another option is to change the program to not have this issue.  What
kinds of programming constructs should I look for that could produce
this kind of sensitivity?

Any help appreciated,

Rob



More information about the Fortran mailing list