|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Thu Sep 26, 2019 12:38 am Post subject: Unwarranted warnings |
|
|
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:
Code: | 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:
Code: | 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.
Last edited by mecej4 on Thu Sep 26, 2019 10:54 am; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Sep 26, 2019 6:47 am Post subject: |
|
|
Thank you for the feedback. I will take a look to see if this can be fixed/improved. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Thu Sep 26, 2019 8:26 am Post subject: |
|
|
The false warning has now been fixed.
I agree that the term "never" is too strong in this particular context but a fix would be non trivial. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|