摘要 |
A method, an apparatus, and a computer program product are disclosed for detecting memory-related errors in a computer program during compiling of the computer program. In the method, static analysis is performed upon a computer program. One or more conditions in the computer program are computed based on the static analysis. Each condition is a test for checking a memory access in the computer program and can be either a pre- or post-condition. The validity of each condition in the computer program is then evaluated. If the evaluation is determinate during compiling, the presence or absence of memory-related errors in the computer program is reported. A condition is determinate if the condition is valid or invalid during compiling. Otherwise, computer code based on the condition is generated for incorporation in the computer program for run-time detection of memory-related errors.
|