[comp.sys.dec] Fascinating DecStation 3100 Fortran problem.

mtsu@blake.acs.washington.edu (Montana State) (05/31/89)

I have this very large Fortran program that I'm trying to get to work on a
Decstation 3100 (MIPS compiler version 1.0, and 1.31).  Two problems.

1)  If compiled with version 1 of the compiler, the program runs fast,
bug generates an output file that consists of NaN, which somebody told me
means not a number.  However, the exact same program works like a charm under
VMS.

2)  If I add a bunch of WRITE(*,*)'s to do  debugging, the program workks
fine, and even the data files stop havind the NAN' in them.

3)  the same program compiled under version 1.31 of the compiler runs
twice as slow as version one, while generateing identical output.  I've
tried all the -O? options, and nothing helps.


Again, the program works fine in VMS Fortran as is.

Any comments or suggestions??

replies to icsu6000@caesar.cs.montana.edu.


Thanx.

graham@fuel.dec.com (kris graham) (06/02/89)

> 1)  If compiled with version 1 of the compiler, the program runs fast,
> bug generates an output file that consists of NaN, which somebody told me
> means not a number.  However, the exact same program works like a charm under
> VMS.
> 



I am taking a guess (not knowing your code) on how to get rid of those NaNs...

Try compiling with the -static option.  

The -static option saves local variables in one static location.
Subsequent calls to the procedure containing the variables can 
change their values.

The DECstation 3100 (aka PMAX) Fortran compiler, unlike some other F77-compatible compilers,
does not have the -static switch as a default.

Hey, I speak for myself..not for Digital.

Christopher Graham, [ graham@fuel.dec.com ]
Digital Equipment Corp,
Ultrix Resource Center,

llocp@rivm.UUCP (Charlos Potma) (06/08/89)

In article <1253@riscy.dec.com>, graham@fuel.dec.com (kris graham) writes:
> 
> > 1)  If compiled with version 1 of the compiler, the program runs fast,
> > bug generates an output file that consists of NaN, which somebody told me
> > means not a number.  However, the exact same program works like a charm under
> > VMS.
> > 
> 
> 
> 
> I am taking a guess (not knowing your code) on how to get rid of those NaNs...
> 
> Try compiling with the -static option.  
> 
> The -static option saves local variables in one static location.
> Subsequent calls to the procedure containing the variables can 
> change their values.
> 
> The DECstation 3100 (aka PMAX) Fortran compiler, unlike some other F77-compatible compilers,
> does not have the -static switch as a default.
> 
> Hey, I speak for myself..not for Digital.
> 
> Christopher Graham, [ graham@fuel.dec.com ]
> Digital Equipment Corp,
> Ultrix Resource Center,

I am not certain if this is the appropriate place to mention but:

We had the same problem: NaN's were produced however,when porting
F77 code from a HP9000/550 to a HP9000/840 machine.
The HP Fortran 77 Reference Manual states:
(speaking about real format)
If the exponent is all 1s and the fraction is 0,the number is
regarded as signed infinity. If the exponent is all 1s and the
fraction is not 0,then the interpretation is "not-a-number"
(NAN).
......

So perhaps in this case the problem is caused by an illegal
operation on a variable . It might be a case
of an "unforgiving" Fortran compiler on the DECstation,
whereas the VMS compiler assured (?) clipping the variables
to max or min range.

We found that a NaN could be produced by : 0.0/0.0
                                      or : INF/INF

The HP F77 compiler has an option to generate a trap when an
attempt is made to operate on infinities and NaNs, to make it
easier to trace the problem. Perhaps DEC Fortran has the same option.

I am not familiar however with DEC systems,I am speaking
here as a Fortran programmer.

Charlos Potma
National Institute for Public Health and Environment
Laboratory for Air Research
Pb 1 3720 Bilthoven
The Netherlands.
mcvax!rivm!llocp