Mechanized Formal Semantics and Verified Compilation for C++ Objects

Abstract : C++ is one of the most widely used programming languages in practice, including for embedded critical software. Thus, it becomes interesting to apply formal methods to programs written in C++. To this end, it is necessary to rely on a formal semantics of C++. Moreover, such a formal semantics can be validated as a basis to the specification and proof of a verified realistic compiler for C++ to gain confidence in the implementation techniques of mainstream C++ compilers. In this thesis, we focus on the C++ object model. We formally specify C++ multiple inheritance with C-style embedded structures, leading us to study the concrete representation of objects with empty base optimizations. We propose a set of sufficient layout conditions, and we show that they are sound with respect to field accesses and polymorphic operations. We then specify a realistic layout algorithm based on the Common Vendor ABI for Itanium, and an extension performing empty member optimizations, and we prove that they satisfy our conditions. We obtain a verified realistic compiler from a subset of C++ to a 3-address language with low-level memory accesses. Extending our semantics with object construction and destruction, we study their intrications with multiple inheritance. This leads us to formalize resource management, namely resource acquisition is initialization through the subobject construction and destruction order. We also study the impact on polymorphic operations such as virtual function dispatch during construction and destruction, by generalizing the notion of dynamic type. We obtain a verified compiler for our extended semantics, in particular by verifying the implementation of dynamic type changes. All our specifications and proofs are carried out with Coq.
Complete list of metadatas

Cited literature [69 references]  Display  Hide  Download

https://tel.archives-ouvertes.fr/tel-00769044
Contributor : Xavier Leroy <>
Submitted on : Thursday, December 27, 2012 - 6:32:06 PM
Last modification on : Friday, May 25, 2018 - 12:02:07 PM
Long-term archiving on : Thursday, March 28, 2013 - 3:48:46 AM

Identifiers

  • HAL Id : tel-00769044, version 1

Collections

Citation

Tahina Ramananandro. Mechanized Formal Semantics and Verified Compilation for C++ Objects. Programming Languages [cs.PL]. Université Paris-Diderot - Paris VII, 2012. English. ⟨NNT : 2012PA077001⟩. ⟨tel-00769044⟩

Share

Metrics

Record views

394

Files downloads

399