Most common run-time errors?

What are the most common run-time errors in your programs? For me they are

  1. Using allocate for a variable that is already allocated.
  2. Using an optional variable that is not present.
  3. Mismatched format string and output. (I should get in the habit of using the G edit descriptor.)
  4. Out-of-bounds array access.

I want to see if a tool can catch most common errors through static analysis. For (1) you could add if (allocated(x)) deallocate (x) before allocate(x(…) unless the static analyzer can prove that x has not been allocated. For (2) you could similarly add an if (present(x)) guard. For (3), when the variables to be printed are scalars or arrays with fixed sizes, a tool could check for mismatched formats.

1 Like