This is the problem !
Compilers that did auto-initialise to zero have created this lazy mess.
It is much better with most modern compilers that identify uninitialised variables as an error.
As for “enforcing strict programming practice”, perhaps these need to be reviewed first. It is also important that these approaches are enforced throughout the project and not just in updated code.
When I learnt Fortran, most of us were scientists and engineers. Those of us who persisted realised that a sensible and consistent programming practice was required. There always were some senior staff and phd’s that were recognised for writing dodgy code that had to be checked before use.
Could I also point out there is a difference between :
- using the compiler option to zero all variables;
- using a “data” statement; “data aa = 0” which is applied at compile time and
- the executable statement “aa = 0” which is executed on each entry to the routine.
This is a surprising error, as the most basic code checking should identify the problems associated with the first 2 cases.
(The data statement use must be understood for it’s implicit save, which can be problematic in an OpenMP scope, as in Questions on variable scope in parallel computing)