C run-time checking

Walter Bright bright at Data-IO.COM
Thu Mar 17 05:32:34 AEST 1988


In article <763 at uvm-gen.UUCP> hartley at uvm-gen.UUCP (Stephen J. Hartley) writes:
>Are there C compilers provided by any
>vendors that generate code to perform run-time checking (toggled
>by an option on the command line, say)?

All 8086 compilers have a compile-time option to insert code that checks
for stack overflow. The lack of CPU hardware to check for this is a MAJOR
BOTCH! A lot of effort is expended in this direction, and even then it
is not 100% reliable (what if an interrupt occurs...).

My run-time libraries not only check if the stack pointer is past the end
of the stack, but also a 'sentinal' is checked. The sentinal is a word
of a known value that is inserted at the end of the stack. If the stack
overflows, probabilities are that this word will get trashed. Thus you
can check to see if the stack overflowed sometime in the past.



More information about the Comp.lang.c mailing list