What are the most common run-time errors in your programs? For me they are
- Using
allocatefor a variable that is already allocated. - Using an
optionalvariable that is notpresent. - Mismatched format string and output. (I should get in the habit of using the G edit descriptor.)
- 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.