Patent ID: 7836434

Claim:
A method in a data processing system for use in performing bound checking in source code, the source code having a pointer referenced as an array, the method comprising: parsing, by a compiler, the source code to detect array allocation statements and array accesses to the array allocation statements; determining, when an array allocation statement is detected by the compiler during the parsing step, whether the array is dynamically allocated at run-time or statically defined based on the array allocation instruction; if the array is statically defined, determining, by the compiler, whether any array access is outside of determined bounds of the array and issuing an error message when an array access is outside of the determined bounds without performing a run-time bounds check operation; and if the array is dynamically, allocated, performing, by the compiler, a bounds check operation on array accesses within the source code, wherein: if the compiler determines while performing the bounds check operation that an array access is out-of-bounds of the array, then the compiler issues an error message for the array access; and if the compiler is unable to determine while performing the bounds check operation that an array access is out-of-bounds of the array, then the compiler performs a run-time bounds check operation before the array access is executed.