STLlint: lifting static checking from languages to libraries

Traditional static checking centers around finding bugs in programs by isolating cases where the language has been used incorrectly. These language‐based checkers do not understand the semantics of software libraries, and therefore cannot be used to detect errors in the use of libraries. In this paper, we introduce STLlint, a program analysis we have implemented for the C++ Standard Template Library and similar, generic software libraries, and we present the general approach that underlies STLlint. We show that static checking of library semantics differs greatly from checking of language semantics, requiring new representations of program behavior and new algorithms. Major challenges include checking the use of generic algorithms, loop analysis for interfaces, and organizing behavioral specifications for extensibility. Copyright © 2005 John Wiley & Sons, Ltd.

[1]  William H. Harrison,et al.  Compiler Analysis of the Value Ranges for Variables , 1977, IEEE Transactions on Software Engineering.

[2]  Deepak Goyal,et al.  Deriving specialized program analyses for certifying component-client conformance , 2002, PLDI '02.

[3]  Constantine D. Polychronopoulos,et al.  Symbolic analysis for parallelizing compilers , 1996, TOPL.

[4]  Shigeru Chiba,et al.  A metaobject protocol for C++ , 1995, OOPSLA.

[5]  Michael J. Vilot,et al.  Standard template library , 1996 .

[6]  Douglas Gregor,et al.  High-level static analysis for generic libraries , 2004 .

[7]  Rudolf Eigenmann,et al.  Symbolic range propagation , 1995, Proceedings of 9th International Parallel Processing Symposium.

[8]  Clemens A. Szyperski,et al.  Iteration abstraction in Sather , 1996, TOPL.

[9]  Michael Wolfe,et al.  Beyond induction variables , 1992, PLDI '92.

[10]  Sibylle Schupp,et al.  Concept-based component libraries and optimizing compilers , 2002, Proceedings 16th International Parallel and Distributed Processing Symposium.

[11]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.

[12]  Douglas Gregor,et al.  Retaining Path-Sensitive Relations Across Control-Flow Merges , 2003 .

[13]  Scott Meyers,et al.  Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library , 2001 .

[14]  Dawson R. Engler,et al.  Interface Compilation: Steps Toward Compiling Program Interfaces as Languages , 1999, IEEE Trans. Software Eng..

[15]  Patrick Chan,et al.  The Java Class Libraries: Supplement for the Java 2 Platform , 1999 .

[16]  Michiaki Tatsubori,et al.  Programming Support of Design Patterns with Compile-time Reflection , 2000 .

[17]  Craig Schaffert,et al.  CLU Reference Manual , 1984, Lecture Notes in Computer Science.

[18]  Matthew Harold Austern,et al.  Generic programming and the STL , 1998 .

[19]  François Bourdoncle,et al.  Efficient chaotic iteration strategies with widenings , 1993, Formal Methods in Programming and Their Applications.

[20]  Alexander A. Stepanov,et al.  Algorithm‐oriented generic libraries , 1994, Softw. Pract. Exp..

[21]  簡聰富,et al.  物件導向軟體之架構(Object-Oriented Software Construction)探討 , 1989 .

[22]  Bowen Alpern,et al.  Detecting equality of variables in programs , 1988, POPL '88.

[23]  David R. Musser,et al.  STL tutorial and reference guide - C++ programming with the standard template library , 1996, Addison-Wesley professional computing series.

[24]  Jeremy G. Siek,et al.  Concept Checking: Binding Parametric Polymorphism in C++ , 2000 .

[25]  Laurie J. Hendren,et al.  Context-sensitive interprocedural points-to analysis in the presence of function pointers , 1994, PLDI '94.

[26]  Richard G. Hamlet,et al.  Automatically Checking an Implementation against Its Formal Specification , 2000, IEEE Trans. Software Eng..

[27]  David R. Musser,et al.  Dynamic Verification of C++ Generic Algorithms , 1997, IEEE Trans. Software Eng..

[28]  Greg Nelson,et al.  Extended static checking for Java , 2002, PLDI '02.

[29]  Sibylle Schupp,et al.  Making the Usage of STL Safe , 2002, Generic Programming.

[30]  Dennis Gannon,et al.  Active Libraries: Rethinking the roles of compilers and libraries , 1998, ArXiv.

[31]  James C. King,et al.  Symbolic execution and program testing , 1976, CACM.

[32]  Richard Kreckel,et al.  Introduction to the GiNaC Framework for Symbolic Computation within the C++ Programming Language , 2000, J. Symb. Comput..

[33]  Murray Hill,et al.  Lint, a C Program Checker , 1978 .

[34]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[35]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[36]  Ken Arnold,et al.  The Java Programming Language , 1996 .

[37]  Laurie J. Hendren,et al.  Is it a tree, a DAG, or a cyclic graph? A shape analysis for heap-directed pointers in C , 1996, POPL '96.

[38]  Gary T. Leavens An Overview of Larch/C++: Behavioral Specifications for C++ Modules , 1996 .

[39]  Reinhard Wilhelm,et al.  Solving shape-analysis problems in languages with destructive updating , 1998, TOPL.

[40]  R. Kramer iContract - The Java(tm) Design by Contract(tm) Tool , 1998 .

[41]  Jeremy G. Siek,et al.  Caramel: A Concept Representation System for Generic Programming , 2001 .

[42]  Yang Meng Tan,et al.  LCLint: a tool for using specifications to check code , 1994, SIGSOFT '94.