RecentlyI updated some single precision code to double precision. This is some very old FORTRAN written on a VAX that has been updated to work on PCs using a number ofdifferent versions of FORTRAN but most recentlyIntel FORTRAN.
The problem is that there was a call from one subroutine to another and in that call a hard-coded value of -100. was passed to a function that expected a double precision value.
Here are the code snippets.
Notice -100. is hard coded in the function call (I know this is bad)
IF(S.EQ.0. .OR. H.EQ.0.)RETURN
DPRT expects a double precision argument!
!DEC$ATTRIBUTES DLLEXPORT :: DPRT
REAL(8) t, p, A(58), PP,TT
Upon debugging I see the value of TT is garbage inside the DPRT function.
I went in and found the /fpconstant compiler switch "Extend Precision of Single-Precision Constants" hoping that this would solve the problem. But it did not work.
I'm guessing the compiler switch is not meant to fix the error I found, but can someone explain why?
I was hoping to find a compiler switch because I don't know of a good way to search the code for all the instances where a hard-coded constant like this may have been used. Currently I change the -100. to -100.0D0 to solve the problem.