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. STLlint: LIFTING STATIC CHECKING FROM LANGUAGES TO LIBRARIES 227 and 'sorted' post-condition describe particular orderings on the values that will be referenced by the given iterators. Overall, static checking given such a high-level specification must cope with abstractions far from the language itself, including user-defined data types described only by their conceptual requirements, and must provide checking for semantic guarantees written in terms of these abstractions.We present here the challenges of 'lifting' a static checker from the language level to the level of abstract, generic software libraries. We focus on the widely used C++ STL and its abstractions, and present our 'higher-level' static checker STLlint [14] that performs checking of the use of the STL. Characteristic of our approach is that it is based on symbolic execution rather than on abstract interpretation, which proved to be too imprecise for our purpose. While most of the symbolic techniques we employ are not new themselves, we combine them in a way that they together can address the unique challenges of library analysis. In addition, we present the first attempt at user-centric, extensible static checking for generic software libraries such as the C++ STL. The resulting tool, STLlint, can handle STL in its entirety, with no restrictions; empirical tests of STLlint include comprehensive sets of examples from two standard textbooks and showed a low false positive rate of 0.59%.This article is presented as follows. Section 2 describes the motivation behind STLlint, illustrating the shortcomings of language-level static checking and the need for library-aware static checkers. We then describe the challenges we have faced in the construction of STLlint and the methods we have used to overcome those challenges, including our approach to checking with abstractions in Section 3, the challenges of dealing with iterators as higher-level induction variables in Section 4, and a way to manage extensibility in a large generic library in Section 5.
Abstract. For abstract data types (ADTs) there are many potential optimizations of code that current compilers are unable to perform. These optimizations either depend on the functional specification of the computational task performed through an ADT or on the semantics of the objects defined. In either case the abstract properties on which optimizations would have to be based cannot be automatically inferred by the compiler. In this paper our aim is to address this level-of-abstraction barrier by showing how a compiler can be organized so that it can make use of semantic information about an ADT at its natural abstract level, before type lowering, inlining, or other traditional compiler steps obliterate the chance. We present an extended case study of one component of a C++ compiler, the simplifier; discuss the design decisions of a new simplifier (simplifier generator) and its implementation in C++; and give performance measurements. The new simplifier is connected to the Gnu C++ compiler and currently performs optimizations at very high level in the front end. When tested with the Matrix Template Library, a library already highly fine-tuned by hand, we achieved run-time improvements of up to six percent.
We provide a new technique for pattern matching that is based on components for each match. The set of match statements and their order is open for configuration at the right time and takes place in a feature-oriented fashion. This gives rise to a solution to the Expression Problem in presence of defaults. It takes a lightweight discipline to develop components for our technique. Their use for configuration of the pattern match, however, is virtually automatic.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
hi@scite.ai
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.