Any bounds-checking C compilers?

Barry Margolin barmar at think.COM
Sat Jun 25 01:54:27 AEST 1988


In article <4033 at pasteur.Berkeley.Edu> faustus at ic.Berkeley.EDU (Wayne A. Christopher) writes:
>Are there any C compilers that compile in run-time bounds checking for array
>accesses?

The Symbolics C compiler, for Symbolics Lisp Machines, does various
kinds of bounds checking.  For malloc'ed data, it makes sure that you
don't reference outside the size you specified; i.e.

	ptr = malloc (10);
	foo = *(ptr + 11)

should generate an error.  For automatic variables, it checks that you
reference within the stack frame, but it doesn't check individual
arrays.

This bounds checking incurs little performance overhead, because it is
done by hardware array instructions, which do the checking in parallel
with the memory reference.

Barry Margolin
Thinking Machines Corp.

barmar at think.com
{uunet,harvard}!think!barmar



More information about the Comp.lang.c mailing list