Year: 2011
Type: dissertation
Abstract: Static program analysis is a technique to prove properties of a program without executing its code. Tools that implement static analysis show on an abstraction of a given program that no state in this program violates a user provided property. The abstraction results from an over-approximation of the set of possible executions of the program. If no state that violates the desired property can be reached in the abstraction, static analysis can guarantee that this state will also not be reached in the original program. Even though, static analysis methods are meant to prove the correctness of a program, in practice, they are mostly used to detect errors. Static analysis offers powerful support to detect even sophisticated errors that are hard to find using testing. The drawback of using static analysis for error detection is that they might emit false warnings. A false warning occurs, when a violation of a property is detected in the abstraction of the program that does not occur in the original program. False warnings are caused by the loss of precision during abstraction. False warnings can be eliminated if the programmer manually refines the abstraction by providing additional information (e.g., by providing invariants). A second kind of errors that is considered a false warnings is errors that occur for unrealistic input values of a program. Static analysis considers all possible input values of a program. If the analysis is supposed to consider only certain input values, the programmer has to specify this by providing preconditions. Specifying preconditions is a time consuming process. Usually, the precondition has to be refined several times, as the scope of a method is not clear in the early stages of development. False warnings of both kinds are a severe limitation to the usability of static analysis. This motivates the central research question of this thesis: Is it possible to develop a static analysis that detects a non-empty set of relevant program errors but never reports false warnings (neither false warnings due to abstraction nor false warnings due to weak preconditions)? The central contribution of this thesis is a constructive answer to this challenge. We introduce the concept of doomed program points. Doomed program points indicate program fragments that inevitably crash on any possible execution of the program. A programmer can, under no circumstances, ignore the presence of a doomed program point. The first contribution of this thesis is that we show that the concept of doomed program points can be formalized. We show that doomed program points occur frequently during the coding phase of a program. This leads to the question if doomed program points can be detected without producing false warnings. We present a static analysis that detects doomed program points automatically and precisely, i.e. without emitting false warning. The analysis does neither require user provided information in terms of annotations specifying invariants (“assume”) nor in terms of annotations specifying correctness (“assert”). However, the analysis can make use of specification to detect other kinds of errors. The analysis computes a guarantee in terms of a formal proof for the absence of doomed program points on an abstraction of the given program. That is, the power of abstraction is not used, as usually in static analysis, to guarantee the absence of errors, but to guarantee the presence of errors. Annotations can be used to reduce the loss of precision that is caused by the abstraction and thus help to increase the detection rate. The proof computed by the analysis is valid for any input value of the program and is a valid proof for any non-empty subset of input values. That is, a doomed program point can never be eliminated (i.e., ignored) by excluding some non-realistic input values. We ask if the above mentioned analysis can be realized efficiently. We give a positive answer and present an implementation that can detect doomed program points without producing false warnings and without the need for user interaction. The implementation works without any user provided information about the pre-state of a method or the in- variants of a loop. Yet, it supports specification languages to increase the detection. The implementation is based on existing and established frameworks for static analysis. We present several optimizations for this implementation and show that it is applicable in practice. Doomed pro- gram point detection is an easy-to-use but powerful analysis that can help to make the use of specification languages and static verifiers more common in todays software engineering.
Author: Martin Schäf
Institution: University of Freiburg
Language: English
Subfield: Software
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W2593240433
