We were working with a large program that contains a mix of REAL and REAL*4 declarations, and wanted to test how using /DREAL would affect the output results. The output results are written to a large file that we examine and compare with similar files from other runs. The following program captures how we detected that /DREAL had been used:
program S_or_D
implicit none
real x
real(2) d
!
if (kind(x) == kind(d)) then
print *,'/DREAL used, x is double precision'
else
print *,'x is single precision'
endif
end program
When I compile this code, I get two messages that are either not justified or are too strongly worded:
WARNING - Variable X has been used without being given an initial value
0004) real(2) d
WARNING - Variable D has been used without being given an initial value
0006) if (kind(x) == kind(d)) then
COMMENT - This IF statement is redundant as it will never succeed
NO ERRORS, 2 WARNINGS, 2 COMMENTS [<S_OR_D> FTN95 v8.51.0]
Inquiry functions such as KIND and ALLOCATED take arguments that need not be defined. Likewise, variables that receive the result of clauses such as IOSTAT = ios in a file access statement need not be defined before the execution of that statement. I think that, therefore, the warning should not have been issued.
The comment is probably OK for the majority of programs ... but: the program above gives a counterexample, so 'never' is too strong.