In a Fortran program, I have the variable “count” declared and used in the main program. I also have a Subroutine, contained by the main, in which one of the formal parameters also is named “count” (it corresponds to the actual parameter “count” passed by the main). In this function I declare “count” as an integer variable as it takes,
Remainder of declaration
Body of the Subroutine
but I got from the pgf90 compiler:
PGF90-W-0119-Redundant specification for count (service.f: 392)
0 inform, 1 warnings, 0 severes, 0 fatal for service
Note that line 392 is the line wherein I declare “count” in the subroutine.
Nevertheless the compiler mentions the name of the main (service).
If I don’t declare “count” in the subroutine the compiler complains that:
PGF90-S-0038-Symbol, count, has not been explicitly declared (service.f)
0 inform, 0 warnings, 1 severes, 0 fatal for assign
mentioning correctly the name of the subroutine.
This formal parameter has the same name as the original actual parameter in the main, but this shouldn’t be a problem.
In any case if I change the actual parameter’s name, then it works.
And if I keep the formal parameter named “count”, but I initialize in a “Data” statement in the main the value of the original variable and (actual parameter) “count”, it works too !! This last fact is the most uncomprehensible.
Any explanation ?