debugging flags

Hi All,

The -Mbounds flag causes the program execution to stop if an array index is out of bounds (for example an index of 22 was requested for an array with 20 elements ranging from 1 to 20). Are there other compiler flags to make the execution stop for other common problems, like making use of an uninitialized variable, output conversion errors, etc.?

Thanks,

Jerry

Hi Jerry,

We have a few error checks you can use, but I tend to use Valgrind for these types of runtime issues.

  • -M[no]bounds : Generate code to check array bounds
  • -Mchkptr : Check for NULL pointers
  • -Mchkstk : Check for sufficient stack space upon subprogram entry
  • -Ktrap=divz|fp|inexact|inv|none|ovf|unf : Determine IEEE Trap conditions
  • -K[no]ieee : Use IEEE division, optionally enable traps

Bounds checking via -Mbounds is a bit hit or miss and only works well if you have an array descriptor (i.e. it might not work well in you case since you’re using F77 calling conventions so are just passing in a raw pointer). Valgrind will intercept the allocation calls so can keep better track of raw pointers.

-Mat