THE VERIFIED C COMPILER
CompCert Lab
Compile C to assembly, follow a program through the pipeline, and change a verified optimization pass.
Compile a C program
Edit a preset and run CompCert 3.18. Switch between -O0 and -O1 to compare the generated assembly.
Run this program locally
Use an installed ccomp or build it from source. The downloaded file includes a small test in main. A run exits with status 0 when that test passes.
In a build checkout, save the preset there and use ./ccomp. For the link command, use ./ccomp -stdlib ./runtime to find the freshly built runtime library.
Follow the pipeline
Trace choose.c from source to assembly. Select a stage to see its representation and where to find it in the compiler.
The semantic preservation theorem connects CompCert C to its assembly model for successful compilation. The driver also invokes external tools for preprocessing, assembling and linking. Read about the proof boundary.
Generate these files locally
Change a verified pass
Build the compiler, trace constant propagation, then change how far it can look ahead through a control-flow graph.
Try the lookahead budget
This model follows successor_rec over a small RTL graph. Give it a known condition and enough fuel to bypass the branch.
- L1
Inop - L2
Icond - L3 · true edge
Ireturn - L4 · false edge
Ireturn