Next: , Previous: Not My Type, Up: Working Programs


14.4.2 Variables Assumed To Be Zero

Many Fortran programs were developed on systems that provided automatic initialization of all, or some, variables and arrays to zero. As a result, many of these programs depend, sometimes inadvertently, on this behavior, though to do so violates the Fortran standards.

You can ask g77 for this behavior by specifying the -finit-local-zero option when compiling Fortran code. (You might want to specify -fno-automatic as well, to avoid code-size inflation for non-optimized compilations.)

Note that a program that works better when compiled with the -finit-local-zero option is almost certainly depending on a particular system's, or compiler's, tendency to initialize some variables to zero. It might be worthwhile finding such cases and fixing them, using techniques such as compiling with the -O -Wuninitialized options using g77.