[net.arch] Address and subscript checking

brooks@lll-crg.ARpA (Eugene D. Brooks III) (10/12/85)

In article <1729@peora.UUCP> jer@peora.UUCP (J. Eric Roskos) writes:
>> Since these things are program development tools, where speed is not an
>> issue, they should be implemented in software and do not need the any
>> hardware support.  Hence the discussion does not belong in net.arch.
>
>I think our compiler-writers would probably disagree with you... certain
>types of checking (e.g., checking for addresses in a certain range, which
>I suggested back at the beginning of this discussion) is enormously
>difficult to do without hardware support

I fail to see what is difficult about doing a couple of subtracts and
compares to validate pointers and subscipts in a debugger or compiler.
One only needs appropo integer arithmetic and comparison instructions.

Take for instance the case of pointers returned by a storage allocator.
Here one generalizes the single pointer to a structure that includes the
upper and lower limits on the address that the pointer may reach.  The
values are set by the storage allocator and computed using the size of
the allocated block.  When the pointer gets used, its value is checked
against the upper and lower limits.  As all pointers in the program are
generalized in this way, the checking function is tracked through function
calls.  Pointers arising from static array references can be suitably guarded
using the same construct.