I've always been using the
-fdefault-real-8 option of
gfortran to automatically promote every single
REAL declared anywhere in the program to double precision, along with any constant, e.g.
1.23. If I ever wanted to switch back to single precision, I only had to remove that option and recompile, without changing a single character in the source code.
At a point I started using
ISO_FORTRAN_ENV module, since it allows me to use constants like
INPUT|OUTPUT|ERROR_UNIT, as well as
IOSTAT_EOR and others (which seemed to be a good and easy move in the direction of portability, am I wrong?). From then on, I've been seeing and ignoring the following warning
Warning: Use of the NUMERIC_STORAGE_SIZE named constant from intrinsic module ISO_FORTRAN_ENV at (1) is incompatible with option -fdefault-real-8
since such incompatibility seems to have no effect so far.
Now I'd like to get rid of this warning if it is possible and worth it.
If I correctly understood, to avoid this warning I should give up on
-fdefault-real-8 option and change every
REAL(real64) and/or to
REAL(dp) (provided that, in the latter case, the statement
USE, INTRINSIC :: ISO_FORTRAN_ENV, dp => real64 is put in that unit), which is not a difficult task for
Nevertheless, it seems to me that this change wouldn't be the same as using
-fdefault-real-8 option, since all constants would stay single precision as long as I don't add
d0 to them.
option is removed and
ISO_FORTRAN_ENV is used anywhere, is there any way to make any constant across the program behave as each had
Whether or not this is possible, have I correctly extrapolated that I can put the following lines in a single module which is used by all others program units, each of which can then use
dp as kind type parameter?
USE, INTRINSIC :: ISO_FORTRAN_ENV
INTEGER, PARAMETER :: dp = real64
I would prefer this way since I could switch to
real128 or whatever by changing only that line.