Code verification by static analysis: a mathematical programming approach
نویسندگان
چکیده
Automatic verification of computer code is of paramount importance in embedded systems supplying essential services. One of the most important verification techniques is static code analysis by abstract interpretation: the concrete semantics of a programming language (i.e. values χ that variable symbols x appearing in a program can take during its execution) are replaced by abstract semantics (for example the assignment of convex over-approximations X ⊇ χ to x). Using abstract semantics, we represent the effect of the program on X by a function F (X). All sets X satisfying the condition F (X) ⊆ X are such that all values outside X are never assigned to x during program execution. We are particularly interested in finding the smallest such X, which in itself satisfies the fixpoint equation X = F (X): this allows (static) detection of several types of errors, such as overflow-type bugs. Traditionally, the equations X = F (X) are solved computationally using Kleene’s or Policy Iteration algorithms: these methods can only guarantee convergence to the smallest fixpoint X under additional (often stringent) conditions. We propose a mathematical program whose constraints define the same space as X ⊇ F (X) and whose objective function minimizes the size of X, whenever X is an array of intervals. This yields a Mixed-Integer Linear Program for code based on integer arithmetic, and a Mixed-Integer Nonlinear Program otherwise. These programs can then be solved to guaranteed global optimality by means of general purpose Branch-and-Bound type algorithms.
منابع مشابه
A framework for the static verification of api calls
A number of tools can statically check program code to identify commonly encountered bug patterns. At the same time, programs are increasingly relying on external APIs for performing the bulk of their work: the bug-prone program logic is being fleshed-out, and many errors involve tricky subroutine calls to the constantly growing set of external libraries. Extending the static analysis tools to ...
متن کاملStatic Analysis of Dynamic Properties - Automatic Program Verification to Prove the Absence of Dynamic Runtime Errors
This paper introduces formal verification techniques applied by PolySpace Verifier as a static approach to measure dynamic software quality attributes. It is proving the correctness of atomic operations in the source code in regards to run-time errors. PolySpace is unique in assessing dynamic properties with a static analysis of the source code. The document outlines the use of the results duri...
متن کاملFrom Verified Specifications to Verifiable Software∗
Declarative specifications of digital systems often contain parts that can be automatically translated into executable code. Automated code generation, as opposed to manual code writing, eliminates a potential source of errors when a prototype implementation of these models is required. Furthermore, code generation allows for better integration of formal methods into the software development pr...
متن کاملFrom Verified Models to Verifiable Code
Declarative specifications of digital systems often contain parts that can be automatically translated into executable code. Automated code generation may reduce or eliminate the kinds of errors typically introduced through manual code writing. For this approach to be effective, the generated code should be reasonably efficient and, more importantly, verifiable. This paper presents a prototype ...
متن کاملFlemming Nielson: Annotated Type and Effect Systems
Program analysis offers static techniques for predicting safe and computable approximations to the set of values or behaviours arising dynamically during computation; this may be used to validate program transformations or to generate more efficient code. The flow based approach includes the traditional data flow analysis techniques for mainly imperative languages, but also the control flow ana...
متن کامل