A Concrete Memory Model for CompCert

Semantics preserving compilation of low-level C programs is challenging because their semantics is implementation defined according to the C standard. This paper presents the proof of an enhanced and more concrete memory model for the CompCert C compiler which assigns a definite meaning to more C programs. In our new formally verified memory model, pointers are still abstract but are nonetheless mapped to concrete 32-bit integers. Hence, the memory is finite and it is possible to reason about the binary encoding of pointers. We prove that the existing memory model is an abstraction of our more concrete model thus validating formally the soundness of CompCert’s abstract semantics of pointers. We also show how to adapt the front-end of CompCert thus demonstrating that it should be feasible to port the whole compiler to our novel memory model.

[1]  Chucky Ellison,et al.  An executable formal semantics of C with applications , 2011, POPL '12.

[2]  Xavier Leroy,et al.  A Formally-Verified C Static Analyzer , 2015, POPL.

[3]  Xuejun Yang,et al.  Finding and understanding bugs in C compilers , 2011, PLDI '11.

[4]  Sandrine Blazy,et al.  A Precise and Abstract Memory Model for C Using Symbolic Values , 2014, APLAS.

[5]  Sandrine Blazy,et al.  Experiments in validating formal semantics for C , 2007 .

[6]  Jeehoon Kang,et al.  A formal C memory model supporting integer-pointer casts , 2015, PLDI.

[7]  Andrew W. Appel,et al.  The CompCert memory model , 2014 .

[8]  Robbert Krebbers,et al.  Aliasing Restrictions of C11 Formalized in Coq , 2013, CPP.

[9]  Xavier Leroy,et al.  Formal C Semantics: CompCert and the C Standard , 2014, ITP.

[10]  Michael Norrish,et al.  Types, bytes, and separation logic , 2007, POPL '07.

[11]  Robbert Krebbers An operational and axiomatic semantics for non-determinism and sequence points in C , 2014, POPL.

[12]  Marc Pantel,et al.  Formally verified optimizing compilation in ACG-based flight control software , 2012 .

[13]  Gerwin Klein,et al.  Don't sweat the small stuff: formal verification of C code without the pain , 2014, PLDI.

[14]  Xavier Leroy,et al.  Mechanized Semantics for the Clight Subset of the C Language , 2009, Journal of Automated Reasoning.

[15]  Alvin Cheung,et al.  Undefined behavior: what happened to my code? , 2012, APSys.

[16]  Xavier Leroy,et al.  Formal Verification of a C-like Memory Model and Its Uses for Verifying Program Transformations , 2008, Journal of Automated Reasoning.

[17]  Mark A. Hillebrand,et al.  VCC: A Practical System for Verifying Concurrent C , 2009, TPHOLs.

[18]  Eddie Kohler,et al.  The scalable commutativity rule , 2017, Commun. ACM.

[19]  Gerwin Klein,et al.  Bridging the Gap: Automatic Verified Abstraction of C , 2012, ITP.

[20]  Michael Norrish C formalised in HOL , 1998 .

[21]  Xavier Leroy,et al.  Formal verification of a realistic compiler , 2009, CACM.

[22]  Wolfram Schulte,et al.  A Precise Yet Efficient Memory Model For C , 2009, Electron. Notes Theor. Comput. Sci..