3 research outputs found

    Loop Patterns in C Programs

    Get PDF
    In this work, we conduct a systematic study of loops in C programs. We describe static analyses capable of efficiently identifying definite iteration in C code. Our experiments show that over one third of loops in our benchmarks take this form. To cover further loops, we systematically weaken our definition of definite iteration and derive a family of loop classes that are heuristics for definite iteration. We then measure the occurrence of these classes on real-world C code and investigate which statements are used to express them. Finally, we empirically show that our classification is meaningful -- (a) it describes the majority of loops in our benchmarks, (b) the classes are good heuristics for termination, and (c) they can be used as software metrics to characterize benchmarks for software verification

    Loop Patterns in C Programs

    No full text
    Abweichender Titel laut Übersetzung der Verfasserin/des VerfassersZsfassung in dt. SpracheSchleifen sind ein unverzichtbares Konstrukt imperativer Programmiersprachen. Wie Turings frühe Arbeit zum Halteproblem zeigt, bringt die Ausdrucksstärke solcher Anweisungen allerdings unentscheidbare Probleme mit sich. Aus diesem Grund kann die Wirksamkeit eines automatischen Terminierungsbeweises nur anhand praktischer Beispiele demonstriert werden - nach dem Satz von Rice gilt dies gleichermaßen für jede Form der automatischen Programmanalyse. Obwohl nach dem Stand der Technik einige, aber bei weitem nicht alle entscheidbaren Fälle bewältigt werden können, existiert noch keine etablierte Vorstellung von der Schwierigkeit Schleifen zu behandeln in der Scientific Community. Infolgedessen wurde auch das Auftreten "einfacher" und "schwieriger" Schleifen in der Praxis noch nicht beschrieben. Wir empfehlen, dies in einer Studie zu untersuchen. Um Schleifen zu klassieren, bedienen wir uns einer neuen Forschungsrichtung in der Softwareverifikation: Anstatt Programme ausschließlich als mathematische Objekte zu betrachten, behandeln wir sie als von Menschen geschaffene Artefakte, die Informationen an die Leser des Programms richten. Diese sollten zum Zweck der automatischen Programmanalyse eingesetzt werden, sind aber meist nur informell (z.B. als Kommentar) oder implizit (z.B. als von Programmierern benutztes Muster) beschrieben. Daher benötigen wir eine Methode, derartige Informationen über Schleifen zu extrahieren. Eine direkte Anwendung ist die empirische Evaluierung automatischer Programmanalyse -- wie beschrieben von zentraler Bedeutung zur Feststellung akademischer Leistungen als auch der Anwendbarkeit im Software Engineering. Die derzeit übliche Praxis erlaubt jedoch aufgrund der Vielzahl an verwendeten Benchmarks nur eingeschränkte Vergleichbarkeit. Benchmarkmetriken, wie zum Beispiel die Anzahl der oben erwähnten "einfachen" Schleifen, können zur Beschreibung von Benchmarks herangezogen werden und derart die Vergleichbarkeit verbessern. Motiviert vom Stand der Technik führt diese Diplomarbeit eine Studie von Schleifen in C Programmen durch, welche wir basierend auf der Schwierigkeit automatischer Programmanalyse klassifizieren: Wir führen die Klasse der syntaktisch terminierenden Schleifen ein, die ein von Programmierern häufig benutztes Muster beschreiben und einen Terminierungsbeweis anhand minimaler Information erlauben. Wir leiten die Familie der simplen Schleifen ab, indem wir die Kriterien syntaktisch terminierender Schleifen systematisch abschwächen. Dieser Ansatz deckt die Mehrzahl der Schleifen in unseren Benchmarks ab, während er gleichzeitig die Terminierung nach wie vor hinreichend gut beschreibt. Abschließend stellen wir unsere Implementierung Sloopy vor und vergleichen die identifizierten Klassen mit experimentellen Resultaten von Loopus, einem Tool zur Berechnung symbolischer Bounds von Schleifen. Derart zeigen wir, dass simple Schleifen tatsächlich die Schwierigkeit automatischer Programmanalyse erfassen.Loop statements are an indispensable construct to express repetition in imperative programming languages. At the same time, their ability to express indefinite iteration entails undecidable problems, as famously demonstrated by Turing's work on the halting problem. Due to these theoretic limitations, efficacy of a termination procedure can only be demonstrated on practical problems - by Rice's theorem the same goes for any automated program analysis. Even though we have techniques to tackle some but by far not all decidable cases, so far no established notion of difficulty with regard to handling loops exists in the scientific community. Consequently, the occurrence of such "simple" and "difficult" loops in practice has not yet been investigated. We propose to conduct a systematic study that describes classes of loops and empirically determines difficulty of automated program analysis for each class. To arrive at this classification, we draw on a recent direction in software verification: Instead of treating programs merely as mathematical objects, we also consider them as human artifacts that carry important information directed at human readers of the program. This engineering information should be leveraged for automated program analysis, but is usually provided informally (e.g. as comments) or implicitly (e.g. as patterns followed by programmers). Thus, a formally sound framework to extract such information about loops is needed. A direct application of this study is the empiric evaluation of automated program analysis: As discussed, such an evaluation is of central importance to establish academic merit as well as applicability to the software engineering domain. However, as we show, experimental results are currently insufficiently comparable, due to the wide range of benchmark programs used. We propose the introduction of benchmark metrics, such as the number of "simple" loops mentioned above, as a way to characterize benchmarks and achieve better comparability. Motivated by the state of the art, this thesis conducts a systematic study of loops in C programs to classify loops based on the difficulty of automated program analysis. To arrive at our classification, we leverage the program's structure as imposed by the programmer: We introduce the class syntactically terminating loops, a common engineering pattern for which termination proofs can be obtained using minimal information, and describe how to determine class membership. Subsequently, we derive the family of simple loops by systematically weakening syntactically terminating loops along different dimensions, which allows us to describe a majority of loops in our benchmarks while still capturing syntactic termination criteria well. Finally, we present our tool Sloopy and compare the identified loop classes with results experimentally obtained from Loopus, a tool to compute symbolic loop bounds. Thus we show that simple loops indeed capture the difficulty of automated program analysis.8
    corecore