np hard
2009 France meta
16

CompCert — A Formally Verified C Compiler

Xavier Leroy, INRIA, 2009 — a C compiler whose correctness is mechanically proved in Coq. 100,000 lines of proof for ~10,000 lines of compiler. The proof tax made visible.

Xavier Leroy, at INRIA Rocquencourt, led the development of CompCert — a moderately optimizing C compiler whose semantic preservation property is formally proved in the Coq proof assistant. The proof guarantees that any safety property holding of the source program also holds of the compiled assembly: no compiler bug can introduce a vulnerability that was not already present in the source. Targets PowerPC, ARM, x86, and RISC-V. Subset of C is Clight, a large fragment. The proof is roughly 100,000 lines of Coq for a compiler of roughly 10,000 lines of code, representing approximately six person-years of effort. CompCert is now used commercially in safety-critical certification, especially for software targeting DO-178C Level A. The point is not that the compiler is fast (it is competitive but not the fastest); the point is that, alone among production C compilers, it does not have miscompilation bugs.

Leroy, X. (2009). Formal Verification of a Realistic Compiler. Communications of the ACM, 52(7), 107–115. Source →