Static analysis with assert()

The next release of Goanna determines facts about your program from assertions. We can use this information to determine the bounds of variables and the nullity of pointers.

Goanna catching a division by zero

Goanna’s interval analysis can now catch this division by zero:

#include <assert.h>

int bad_div_of_8(int x)
{
  assert(x == 4);
  x -= 3;
  x--;
  return 8 / x;
}
No Comments

Post a Comment