What happens when you write 15,000 lines of Rocq code trying to close the 28% performance gap between a formally verified compiler and the industry-standard GCC.

Aananth V November 13, 2026

A C program passes through CompCert to become x86-64 assembly, with machine-checked proofs.

CompCert (GitHub) is a formally verified C compiler written in Rocq and OCaml. Like gcc or clang, it compiles C to assembly and optimizes the program to be faster along the way; the difference is that CompCert proves that those optimizations preserve the program’s behavior under its formal semantics. You feed a C program into the front end, and it transforms the program through a sequence of optimizations and intermediate representations all the way down to x86-64 assembly code. Each of these transformations in the verified pipeline, also called passes in compiler jargon, is implemented in Rocq or checked by a verified validator, and proved to preserve the program’s behavior under CompCert’s formal semantics of C and x86-64: precise mathematical definitions of what a C program means and what each x86-64 instruction does. At the end, a machine-checked theorem ensures that the generated assembly preserves an allowed behavior of the source C program, provided the source has no undefined behavior under these semantics.1 This makes CompCert particularly suitable for safety-critical software where correctness is just as important as performance, since mainstream compilers such as GCC and LLVM have been shown to silently generate wrong code.234