We present a practical technique for achieving a scalable and precise global static analysis by selectively applying context-sensitivity and the octagon relational domain. For precise analysis, context-sensitivity and relational analysis are key properties, but it has been hard to practically combine both of them. Our approach turns on those precision improvement features only when the analysis is likely to improve the precision to resolve given queries. The guidance comes from an impact pre-analysis that estimates the impact of a fully context-sensitive and relational octagon analysis. We designed a cost-effective pre-analysis and implemented this method in a realistic octagon analysis for full C. The experimental results show that our approach proves eight times more queries, while saving the time cost by 73.1% compared with a partially relational octagon analysis enabled by a syntactic heuristic. > (i.e., no relational information). We observed that, in real C programs, queries that require such inter-procedural reasoning on variable relationships are prevalent (Section 7). Unfortunately, the previous selective X-sensitive analyses estimate each sensitivity separately so that it cannot select those queries. Furthermore, naively combing the existing pre-analyses suffers from the huge cost of the combinatory sensitivities.In this paper, we present a practical technique that selectively combines context-sensitivity and the octagon relational analysis. The basic idea is the existing selective X-sensitive approach [4]. We take both the octagon domain and context-sensitivity into account simultaneously: (1) we design a pre-analysis that conservatively estimates the 'symbiotic' effect of both the fully context-sensitive and fully relational octagon analysis; (2) the pre-analysis predicts where the combination of the two precision-improving techniques will help to prove given queries; and (3) the selective main analysis is derived from the guidance of the pre-analysis results. Our new analysis is different from the previous one [4] in two aspects. First, our analysis is selective both in tracked variable relations and context-sensitivity while the previous approach is selective only in each sensitivity. Second, we propose a cost-effective pre-analysis equipped with the summary-based context-sensitivity [1]. Instead of computing all possible contexts, the new pre-analysis differentiates only a particular set of contexts related to queries that is derived from a backward pre-analysis.Our experimental results show that the selective context-sensitive and relational analysis is precise and scalable. We implemented the selective analysis on top of our Sparrow framework [5]. In experiments with various C benchmarks, the analysis scaled up to 100KLOC and proved 201 queries among 206 queries. In the comparison with the conventional octagon analysis with syntactic variable packing [3], the new analysis proves eight times more queries, saving 73.1% of the analysis's time overhead on average.
Contributions Our contributions are ...