Runtime Checking

On Shaheen II, Cray, Intel and GNU compilers support checking for various error conditions at run time, such as array over bounds.  Please note that runtime checking may degrade performance, therefore it should only be used for debugging.

  • Cray
    • Cray Fortran compiler runtime check can be enabled with the -R option.
      • -Rb  check array bounds
      • -Rc  check array conformance in array expressions
      • -Rp  check association and allocation status for pointer, allocatable and assumed shape arrays
      • -Rs  check character substring bounds
      • To enable all checks specify -Rbcdps.
    • The Cray C/C+ compiler support a limited number of run time checks with the -h option.
      • -h bounds      checks pointer and array references are within acceptable boundaries
      • -h dir_check   enables directive checking at run time
  • Intel 
    • Intel Fortran compiler:
      • -check bounds check array subscript and character bounds
      • -check stack   check the stack frame
      • -check uninit   check for uninitialized variables
      • All run time checks can be enabled with -check all.
    • The Intel C/C++ compilers also support the -check option, though the individual checks differ.
      • -check=conversions check converstions to smaller types
      • -check=stack check the stack frame
      • -check=uninit check for uninitialized variables
  • GNU Compiler
    • GNU fortran  supports run time checks with the -fcheck=<keyword> option.
      • array-temps   warns when a temporary array is created for an actual argument
      • bounds         checks array subscripts against minimum and maximum values
      • do                check for modification of loop iteration variables
      • mem            check memory allocations
      • Multiple keywords from may be used together provided they are comma delimited.
    • The GNU C/C++ compilers support the following run time checks.
      • -fstack-check generate code to check for stack overflow
      • -fcheck-new   check the pointer returned by new is non-null
      • -fstack-protector-all check for buffer overflows

More information is available in the man page of crayftn,craycc,crayCC,ifort,icc,gfortran,gcc,g++