I found what seems like a bug using pgf90 17.7.0 on a cray machine.
pgf90 17.7-0 64-bit target on x86-64 Linux -tp haswell-64
I’m taking 0.0 to a power, which gives a floating point exception. I’ve isolated this problem to a short fortran program:
program simple implicit none real(kind=8) :: r real(kind=8) :: a ,b a = 0.00000000 b = 2.4 write (6,*) "Equation r = ",a , " ** ", b r = a ** (b) write (6,*)"Debugging print r = ", r end program simple
This is what happens when I compile and run:
ftn -Ktrap=ovf simple.F90 && ./a.out
Equation r = 0.000000000000000 ** 2.400000095367432
Floating exception (core dumped)
Here’s where it gets wacky. If I change b = 3.4, the program runs to completion:
grep 3.4 simple.F90
b = 3.4
ftn -Ktrap=fp simple.F90 && ./a.out
Equation r = 0.000000000000000 ** 3.400000095367432
Debugging print r = 0.000000000000000
I’ve tried changing b to a bunch of different numbers. Sometimes the program crashes, and sometimes it runs to completion. Adding “d0” to the end of 0.0000d0 or 2.4d0 does not fix the problem, although that shouldn’t be necessary anyway.
Has anyone else seen this problem? Is it fixed in a later version of the pfg90 compiler?