Skip to main content

An Executable Semantics for CompCert C

  • Conference paper

Part of the Lecture Notes in Computer Science book series (LNTCS,volume 7679)

Abstract

CompCert is a C compiler developed by Leroy et al, the majority of which is formalised and verified in the Coq proof assistant. The correctness theorem is defined in terms of a semantics for the ‘CompCert C’ language, but how can we gain faith in those semantics? We explore one approach: building an equivalent executable semantics that we can check test suites of code against.

Keywords

  • Relational Semantic
  • Memory Model
  • Conditional Expression
  • Abstract Syntax Tree
  • Intermediate Language

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.

The project CerCo acknowledges the financial support of the Future and Emerging Technologies (FET) programme within the Seventh Framework Programme for Research of the European Commission, under FET-Open grant number: 243881.

This is a preview of subscription content, access via your institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (Canada)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (Canada)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (Canada)
  • 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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Amadio, R., Asperti, A., Ayache, N., Campbell, B., Mulligan, D., Pollack, R., Régis-Gianas, Y., Coen, C.S., Stark, I.: Certified complexity. Procedia Computer Science 7, 175–177 (2011)

    CrossRef  Google Scholar 

  2. Berghofer, S., Bulwahn, L., Haftmann, F.: Turning Inductive into Equational Specifications. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 131–146. Springer, Heidelberg (2009), http://dx.doi.org/10.1007/978-3-642-03359-9_11

    CrossRef  Google Scholar 

  3. Blazy, S., Leroy, X.: Mechanized semantics for the Clight subset of the C language. Journal of Automated Reasoning 43, 263–288 (2009), http://dx.doi.org/10.1007/s10817-009-9148-3

    CrossRef  MATH  MathSciNet  Google Scholar 

  4. Programming languages — C. International standard ISO/IEC 9899:1999, ISO (1999)

    Google Scholar 

  5. Campbell, B., Pollack, R.: Executable formal semantics of C. Tech. Rep. EDI-INF-RR-1412, School of Informatics, University of Edinburgh (2010)

    Google Scholar 

  6. Ellison, C., Roşu, G.: An executable formal semantics of C with applications. In: Proceedings of the 39th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2012, pp. 533–544. ACM, New York (2012), http://doi.acm.org/10.1145/2103656.2103719

    CrossRef  Google Scholar 

  7. Free Software Foundation: GNU Compiler Collection (GCC) Internals, version 4.4.3 (2008)

    Google Scholar 

  8. Jourdan, J.-H., Pottier, F., Leroy, X.: Validating LR(1) Parsers. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 397–416. Springer, Heidelberg (2012), http://dx.doi.org/10.1007/978-3-642-28869-2_20

    CrossRef  Google Scholar 

  9. Klein, G., Nipkow, T.: A machine-checked model for a Java-like language, virtual machine, and compiler. ACM Trans. Program. Lang. Syst. 28(4), 619–695 (2006), http://doi.acm.org/10.1145/1146809.1146811

    CrossRef  Google Scholar 

  10. Leinenbach, D., Petrova, E.: Pervasive compiler verification from verified programs to verified systems. Electronic Notes in Theoretical Computer Science 217, 23–40 (2008), http://www.sciencedirect.com/science/article/pii/S1571066108003836

    CrossRef  Google Scholar 

  11. Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52, 107–115 (2009), http://doi.acm.org/10.1145/1538788.1538814

    CrossRef  Google Scholar 

  12. Leroy, X., Blazy, S.: Formal verification of a C-like memory model and its uses for verifying program transformations. Journal of Automated Reasoning 41(1), 1–31 (2008)

    CrossRef  MATH  MathSciNet  Google Scholar 

  13. Letouzey, P.: A New Extraction for Coq. In: Geuvers, H., Wiedijk, F. (eds.) TYPES 2002. LNCS, vol. 2646, pp. 200–219. Springer, Heidelberg (2003)

    CrossRef  Google Scholar 

  14. Lochbihler, A., Bulwahn, L.: Animating the Formalised Semantics of a Java-Like Language. In: van Eekelen, M., Geuvers, H., Schmaltz, J., Wiedijk, F. (eds.) ITP 2011. LNCS, vol. 6898, pp. 216–232. Springer, Heidelberg (2011), http://dx.doi.org/10.1007/978-3-642-22863-6_17

    CrossRef  Google Scholar 

  15. Milner, R., Weyhrauch, R.: Proving compiler correctness in a mechanized logic. Machine Intelligence 7, 51–70 (1972)

    MATH  Google Scholar 

  16. Moore, J.S.: A mechanically verified language implementation. Journal of Automated Reasoning 5, 461–492 (1989), http://dx.doi.org/10.1007/BF00243133

    Google Scholar 

  17. Necula, G.C., McPeak, S., Rahul, S.P., Weimer, W.: CIL: Intermediate Language and Tools for Analysis and Transformation of C Programs. In: CC 2002. LNCS, vol. 2304, pp. 213–228. Springer, Heidelberg (2002)

    CrossRef  Google Scholar 

  18. Rideau, S., Leroy, X.: Validating Register Allocation and Spilling. In: Gupta, R. (ed.) CC 2010. LNCS, vol. 6011, pp. 224–243. Springer, Heidelberg (2010), http://dx.doi.org/10.1007/978-3-642-11970-5_13

    CrossRef  Google Scholar 

  19. Moore, J.S.: Symbolic Simulation: An ACL2 Approach. In: Gopalakrishnan, G.C., Windley, P. (eds.) FMCAD 1998. LNCS, vol. 1522, pp. 334–350. Springer, Heidelberg (1998), http://dx.doi.org/10.1007/3-540-49519-3_22

    CrossRef  Google Scholar 

  20. Tatlock, Z., Lerner, S.: Bringing extensibility to verified compilers. In: Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2010, pp. 111–121. ACM, New York (2010), http://doi.acm.org/10.1145/1806596.1806611

    CrossRef  Google Scholar 

  21. Team, T.C.D.: The Coq Proof Assistant: Reference Manual, Version 8.3. INRIA (2010), http://coq.inria.fr/distrib/8.3pl2/refman/

  22. Tristan, J.B., Leroy, X.: Formal verification of translation validators: a case study on instruction scheduling optimizations. In: Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2008, pp. 17–27. ACM, New York (2008)

    CrossRef  Google Scholar 

  23. Ševčík, J., Vafeiadis, V., Zappa Nardelli, F., Jagannathan, S., Sewell, P.: Relaxed-memory concurrency and verified compilation. In: Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2011, pp. 43–54. ACM, New York (2011), http://doi.acm.org/10.1145/1926385.1926393

    Google Scholar 

  24. Yang, X., Chen, Y., Eide, E., Regehr, J.: Finding and understanding bugs in C compilers. In: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2011, pp. 283–294. ACM, New York (2011), http://doi.acm.org/10.1145/1993498.1993532

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and Permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Campbell, B. (2012). An Executable Semantics for CompCert C. In: Hawblitzel, C., Miller, D. (eds) Certified Programs and Proofs. CPP 2012. Lecture Notes in Computer Science, vol 7679. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-35308-6_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-35308-6_8

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-35307-9

  • Online ISBN: 978-3-642-35308-6

  • eBook Packages: Computer ScienceComputer Science (R0)