Skip to main content

CompCertS: A Memory-Aware Verified C Compiler Using Pointer as Integer Semantics

  • Conference paper
Interactive Theorem Proving (ITP 2017)

Abstract

The CompCert C compiler provides the formal guarantee that the observable behaviour of the compiled code improves on the observable behaviour of the source code. In this paper, we present a formally verified C compiler, CompCertS, which is essentially the CompCert compiler, albeit with a stronger formal guarantee: it gives a semantics to more programs and ensures that the memory consumption is preserved by the compiler. CompCertS is based on an enhanced memory model where, unlike CompCert but like Gcc, the binary representation of pointers can be manipulated much like integers and where, unlike CompCert, allocation may fail if no memory is available.

The whole proof of CompCertS is a significant proof-effort and we highlight the crux of the novel proofs of 12 passes of the back-end and a challenging proof of an essential optimising pass of the front-end.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    \(\lfloor \cdot \rfloor \) denotes the option type. We write \(\lfloor v \rfloor \) for \(\small {\mathrm{Some(v)}}\) and \(\emptyset \) for \(\small {\mathrm{None}}\).

  2. 2.

    Seehttps://github.com/AbsInt/CompCert/blob/a968152051941a0fc50a86c3fc15e90e22ed7c47/backend/ValueDomain.v#L707.

References

  1. Companion website. http://www.cs.yale.edu/homes/wilke-pierre/itp17/

  2. Bedin Franca, R., Blazy, S., Favre-Felix, D., Leroy, X., Pantel, M., Souyris, J.: Formally verified optimizing compilation in ACG-based flight control software. In: ERTS 2012: Embedded Real Time Software and Systems (2012)

    Google Scholar 

  3. Besson, F., Blazy, S., Wilke, P.: A precise and abstract memory model for C using symbolic values. In: Garrigue, J. (ed.) APLAS 2014. LNCS, vol. 8858, pp. 449–468. Springer, Cham (2014). doi:10.1007/978-3-319-12736-1_24

    Chapter  Google Scholar 

  4. Besson, F., Blazy, S., Wilke, P.: A concrete memory model for CompCert. In: Urban, C., Zhang, X. (eds.) ITP 2015. LNCS, vol. 9236, pp. 67–83. Springer, Cham (2015). doi:10.1007/978-3-319-22102-1_5

    Chapter  Google Scholar 

  5. Blazy, S., Trieu, A.: Formal verification of control-flow graph flattening. In: CPP. ACM (2016)

    Google Scholar 

  6. Carbonneaux, Q., Hoffmann, J., Ramananandro, T., Shao, Z.: End-to-end verification of stack-space bounds for C programs. In: PLDI. ACM (2014)

    Google Scholar 

  7. Hathhorn, C., Ellison, C., Rosu, G.: Defining the undefinedness of C. In: PLDI. ACM (2015)

    Google Scholar 

  8. Kang, J., Hur, C., Mansky, W., Garbuzov, D., Zdancewic, S., Vafeiadis, V.: A formal C memory model supporting integer-pointer casts. In: PLDI (2015)

    Google Scholar 

  9. Krebbers, R.: Aliasing restrictions of C11 formalized in Coq. In: Gonthier, G., Norrish, M. (eds.) CPP 2013. LNCS, vol. 8307, pp. 50–65. Springer, Cham (2013). doi:10.1007/978-3-319-03545-1_4

    Chapter  Google Scholar 

  10. Krebbers, R.: An operational and axiomatic semantics for non-determinism and sequence points in C. In: POPL. ACM (2014)

    Google Scholar 

  11. Kroll, J.A., Stewart, G., Appel, A.W.: Portable software fault isolation. In: CSF. IEEE (2014)

    Google Scholar 

  12. Leroy, X.: Formal verification of a realistic compiler. C. ACM 52(7), 107–115 (2009)

    Article  Google Scholar 

  13. Memarian, K., Matthiesen, J., Lingard, J., Nienhuis, K., Chisnall, D., Watson, R.N., Sewell, P.: Into the depths of C: elaborating the de facto standards. In: PLDI. ACM (2016)

    Google Scholar 

  14. Norrish, M.: C formalised in HOL. Ph.D. thesis, University of Cambridge (1998)

    Google Scholar 

  15. Robert, V., Leroy, X.: A formally-verified alias analysis. In: Hawblitzel, C., Miller, D. (eds.) CPP 2012. LNCS, vol. 7679, pp. 11–26. Springer, Heidelberg (2012). doi:10.1007/978-3-642-35308-6_5

    Chapter  Google Scholar 

  16. Ševčík, J., Vafeiadis, V., Zappa Nardelli, F., Jagannathan, S., Sewell, P.: CompCertTSO: a verified compiler for relaxed-memory concurrency. J. ACM 60(3), 22:1–22:50 (2013)

    Article  MathSciNet  Google Scholar 

Download references

Acknowledgments

This work has been partially funded by the French ANR project AnaStaSec ANR-14-CE28-0014, NSF grant 1521523 and DARPA grant FA8750-12-2-0293.

Author information

Authors and Affiliations

Authors

Corresponding authors

Correspondence to Frédéric Besson , Sandrine Blazy or Pierre Wilke .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this paper

Cite this paper

Besson, F., Blazy, S., Wilke, P. (2017). CompCertS: A Memory-Aware Verified C Compiler Using Pointer as Integer Semantics. In: Ayala-Rincón, M., Muñoz, C.A. (eds) Interactive Theorem Proving. ITP 2017. Lecture Notes in Computer Science(), vol 10499. Springer, Cham. https://doi.org/10.1007/978-3-319-66107-0_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-66107-0_6

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-66106-3

  • Online ISBN: 978-3-319-66107-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics