Freeware/BoundsChecking

Bounds Checking GCC

At college I wrote a set of extensions to GCC which enable bounds checking in C code. For instance it would catch this type of error:

int
main ()
{
  int a[10], b[10], i;
 
  for (i = 0; i <= 10; ++i)
    a[i] = 0;
}

No other tool to my knowledge works at this level of detail even today. Of course there was a penalty involved - your program would run about 5 to 10 times slower in the parts where you had enabled bounds checking.

I don't maintain this patch for GCC any more, but Herman ten Brugge has done an excellent job keeping the patch alive for nearly ten years. You can find the patch here:

All enquiries should be directed to him.

Additional resources