Hi!
I have the following problem … when compiling this code as listed - nothing is left out (however it is part of a small subroutine in a MUCH larger program):
Beta = ASIN (sqrt(random_value_1))
write(0,) ‘beta1:’,beta,random_value_1
Beta = ASIN (sqrt(random_value_1))
write(0,) ‘beta2:’,beta,random_value_1
pgf95 -O -Mlist -Mbyteswapio -tp k8-32
I get the following output over N iterations - the first time gives correct values - every other iteration gives an NaN the first time Beta is calculated - despite the fact the statements are identical.
beta1: 0.4755054 0.2095697
beta2: 0.4755054 0.2095697
beta1: NaN 0.7170435
beta2: 1.009910 0.7170435
beta1: NaN 3.9387934E-02
beta2: 0.1997904 3.9387934E-02
If I compile with -
pgf95 -g -Mlist -Mbyteswapio -Mdclchk -Mdepchk -Minform=inform -Minfo -Mbounds -tp k8-32
The output is correct on each iteration - no NaNs appear.
Since unoptimized code gives the correct output I am tempted to consider a compiler optimization bug since the bounds checking does not indicate any memory issues when the code runs correctly - but maybe I am missing something - I am running 64bit Redhat Enterprise Linux 4 on an AMD64 X2 4600+. The issue does not seem to arise on a Intel D840 with 32 bit RHEL4 and only 32 bit compilers installed. I can not run the 64 bit compiler because of a different compiler issue with data corruption I haven’t been able to track down. Could this be a library issue of some sort? The code has run perfectly well in the past - I don’t know what could have changed in the current circumstances except perhaps one of the Redhat libraries. Any suggestions would be appreciated.
Thanks,
David