Abstract
C++ Exceptions provide a useful way for dealing with abnormal program behavior, but often lead to irregular interprocedural control flow that complicates compiler optimizations and static analysis. In this paper, we present an interprocedural exception analysis and transformation framework for C++ that captures the control-flow induced by exceptions and transforms it into an exception-free program that is amenable for precise static analysis. Control-flow induced by exceptions is captured in a modular interprocedural exception control-flow graph (IECFG). The IECFG is further refined using a novel interprocedural dataflow analysis algorithm based on a compact representation for a set of types called the Signed-TypeSet domain. The results of the interprocedural analysis are used by a lowering transformation to generate an exception-free C++ program. The lowering transformations do not affect the precision and accuracy of any subsequent program analysis. Our framework handles all the features of synchronous C++ exception handling and all exception sub-typing rules from the C++0x standard. We demonstrate two applications of our framework: (a) automatic inference of exception specifications for C++ functions for documentation, and (b) checking the “no-throw” and “no-leak” exception-safety properties.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Bravenboer, M., Smaragdakis, Y.: Exception analysis and points-to analysis: Better together. In: International Symposium on Software Testing and Analysis (ISSTA), pp. 1–12. ACM, New York (2009)
Buse, R.P., Weimer, W.R.: Automatic documentation inference for exceptions. In: ISSTA, pp. 273–282. ACM, New York (2008)
Chang, B.-M., Jo, J.-W., Yi, K., Choe, K.-M.: Interprocedural exception analysis for Java. In: Proc. of Symp. on Applied Computing, pp. 620–625 (2001)
Dean, J., Grove, D., Chambers, C.: Optimization of object-oriented programs using static class hierarchy analysis. In: Olthoff, W. (ed.) ECOOP 1995. LNCS, vol. 952, pp. 77–101. Springer, Heidelberg (1995)
Fu, C., Ryder, B.: Exception-chain analysis: Revealing exception handling architecture in Java server applications. In: ICSE, pp. 230–239 (May 2007)
Gherghina, C., David, C.: A specification logic for exceptions and beyond. In: Bouajjani, A., Chin, W.-N. (eds.) ATVA 2010. LNCS, vol. 6252, pp. 173–187. Springer, Heidelberg (2010)
Ivančić, F., Shlyakhter, I., Gupta, A., Ganai, M., Kahlon, V., Wang, C., Yang, Z.: Model checking C programs using F-Soft. In: IEEE International Conference on Computer Design, pp. 297–308 (October 2005)
Jo, J.-W., Chang, B.-M.: Constructing Control Flow Graph for Java by Decoupling Exception Flow from Normal Flow. In: Laganá, A., Gavrilova, M.L., Kumar, V., Mun, Y., Tan, C.J.K., Gervasi, O. (eds.) ICCSA 2004. LNCS, vol. 3043, pp. 106–113. Springer, Heidelberg (2004)
Jo, J.-W., Chang, B.-M., Yi, K., Choe, K.-M.: An uncaught exception analysis for Java. Journal of Systems and Software 72(1), 59–69 (2004)
Lattner, C., Adve, V.: LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In: International Symposium on Code Generation and Optimization (CGO), Palo Alto, California (March 2004)
Li, X., Hoover, H., Rudnicki, P.: Towards automatic exception safety verification. In: Proc. of Formal Methods, pp. 396–411. Springer, Heidelberg (2006)
Mao, C.-Y., Lu, Y.-S.: Improving the robustness and reliability of object-oriented programs through exception analysis and testing. In: IEEE International Conference on Engineering of Complex Computer Systems, vol. 0, pp. 432–439 (2005)
NECLA verification benchmarks, http://www.nec-labs.com/research/system/systems_SAV-website/benchmarks.php
Necula, G.C., McPeak, S., Rahul, S.P., Weimer, W.: CIL: Intermediate language and tools for analysis and transformation of C programs. In: Int. Conf. on Comp. Construct, pp. 213–228. Springer, Heidelberg (2002)
Robillard, M.P., Murphy, G.C.: Static analysis to support the evolution of exception structure in object-oriented systems. ACM Transactions on Software Engineering Methodologies 12(2), 191–221 (2003)
Sinha, S., Harrold, M.J.: Analysis and testing of programs with exception handling constructs. IEEE Trans. on Software Engineering 26, 849–871 (2000)
C.standards commitee. Working draft, standard for programming language C++ (2010), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3126.pdf (accessed September 26, 2010)
Stroustrup, B.: Exception safety: Concepts and techniques. In: Romanovsky, A., Cheraghchi, H.S., Lee, S.H., Babu, C. S. (eds.) ECOOP-WS 2000. LNCS, vol. 2022, pp. 60–76. Springer, Heidelberg (2001)
Torlak, E., Chandra, S.: Effective interprocedural resource leak detection. In: Int. Conf. on Softw. Eng., pp. 535–544. ACM, New York (2010)
Weimer, W., Necula, G.C.: Exceptional situations and program reliability. ACM Trans. Programming Languauges and Systems 30(2), 1–51 (2008)
Weiss, M.A.: Data Structures and Algorithm Analysis in C++. Addison-Wesley Longman Publishing Co., Inc., Boston (1998)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Prabhu, P., Maeda, N., Balakrishnan, G., Ivančić, F., Gupta, A. (2011). Interprocedural Exception Analysis for C++. In: Mezini, M. (eds) ECOOP 2011 – Object-Oriented Programming. ECOOP 2011. Lecture Notes in Computer Science, vol 6813. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-22655-7_27
Download citation
DOI: https://doi.org/10.1007/978-3-642-22655-7_27
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-22654-0
Online ISBN: 978-3-642-22655-7
eBook Packages: Computer ScienceComputer Science (R0)