support array bounds checking

Herman ten Brugge
Wed Jun 30 23:15:00 GMT 1999


I just implemented the hybrid implementation suggested by Per Bothner
in my version of bounds checking for gcc. This version is present at

I started implementing on last friday so there may be errors in the
current release. I also have to optimize some more things. I did allready
implement some small improvements. I also found a small problem when
invalidating chunks. The assigment 'P1 = P2' should be rewritten as
'P1$chunk = UNKNOWN_CHUNK, P1 = P2'. There is a problem when P2 uses P2$chunk.
So I rewrote this as 'tmp = (P1 = P2), P1$chunk = UNKNOWN_CHUNK, tmp'.
I did the same for invalidating pointer operations.

The effect of these patches are faster bounds-checking code. I have to
repeat some tests from Richard Jones to check how much faster the code
really is. There will allways be a slowdown of about a factor 4 to 5 
because we have to validate every pointer operation. A slowdown of
50 as mentioned in Richard Jones report will probably not occur anymore
because of this hybrid implementation.


More information about the Gcc-patches mailing list