An Executable Semantics for CompCert C

  • Brian Campbell
Part of the Lecture Notes in Computer Science book series (LNCS, 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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)CrossRefGoogle Scholar
  2. 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 CrossRefGoogle Scholar
  3. 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 MATHMathSciNetCrossRefGoogle Scholar
  4. 4.
    Programming languages — C. International standard ISO/IEC 9899:1999, ISO (1999)Google Scholar
  5. 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. 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 CrossRefGoogle Scholar
  7. 7.
    Free Software Foundation: GNU Compiler Collection (GCC) Internals, version 4.4.3 (2008)Google Scholar
  8. 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 CrossRefGoogle Scholar
  9. 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 CrossRefGoogle Scholar
  10. 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 CrossRefGoogle Scholar
  11. 11.
    Leroy, X.: Formal verification of a realistic compiler. Commun. ACM 52, 107–115 (2009), http://doi.acm.org/10.1145/1538788.1538814 CrossRefGoogle Scholar
  12. 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)MATHMathSciNetCrossRefGoogle Scholar
  13. 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)CrossRefGoogle Scholar
  14. 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 CrossRefGoogle Scholar
  15. 15.
    Milner, R., Weyhrauch, R.: Proving compiler correctness in a mechanized logic. Machine Intelligence 7, 51–70 (1972)MATHGoogle Scholar
  16. 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. 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)CrossRefGoogle Scholar
  18. 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 CrossRefGoogle Scholar
  19. 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 CrossRefGoogle Scholar
  20. 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 CrossRefGoogle Scholar
  21. 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. 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)CrossRefGoogle Scholar
  23. 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. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Brian Campbell
    • 1
  1. 1.LFCS, University of EdinburghUK

Personalised recommendations