CompCert
More info
- Creator
- Xavier Leroy
- Owner
- Inria
- Type
- C compiler
- Website
- compcert.org
A C compiler that comes with a machine-checked proof that the code it emits does what the source says — no more, no less.
Xavier Leroy at Inria began the work in 2005 and described the backend in a POPL paper in 2006. The compiler is written and proven in the Coq proof assistant, and every pass between its dozen or so intermediate representations carries a theorem stating that it preserves the program's meaning. Optimiser bugs are therefore not merely unlikely but provably absent, provided the specification and the proof checker hold up.
The most persuasive evidence came from outside. When Csmith turned up hundreds of miscompilations in GCC and LLVM in 2011, it could not find a single one in CompCert's verified middle end. The cost is performance roughly on par with gcc -O1 and a limited set of targets. AbsInt sells it commercially to the aviation and nuclear industries, where a proof can matter more than ten percent faster code.