Navigation: Previous   Up   Next

2.15 Undefined Variable Detection

Use of undefined variables can be detected with the -C=undefined option. Program units compiled with this option use a different ABI, which means that they are incompatible with program units compiled without this option, and not interoperable with C; thus the whole program must be Fortran code and compiled the same way. For this reason, -C=undefined is not part of -C or -C=all.

Currently, there are a number of other limitations on the use of -C=undefined.

  1. It is incompatible with pointers in an initialised COMMON.
  2. All intrinsic modules are available, but the ISO_C_BINDING module can only be used with all-Fortran programs as the option makes changes to the ABI.
  3. Internal READ from a CHARACTER array requires the entire specified array subobject to be “defined”, even those elements corresponding to records not actually read.
  4. Internal WRITE to a CHARACTER array is considered to define the entire specified array subobject, even those elements corresponding to records not actually written.
  5. Certain intrinsic functions require the entirety of their arguments to be defined, even if some portions are not actually required for the value of the function. For example, the PAD argument to RESHAPE when no padding is actually required, and elements of the ARRAY argument to PACK that correspond to false elements of the MASK.
  6. It is incompatible with the use of OpenMP directives.
  7. It cannot be used on types with length type parameters.
  8. It cannot be used when CLASS(*) variables are allocated using the MOLD= specifier.