CompCert Lab Zhiyang Chen

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.

Optimization
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.

Download preset
Terminal

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.

Open upstream source

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
Download choose.c
Terminal

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.

  1. L1Inop
  2. L2Icond
  3. L3 · true edgeIreturn
  4. L4 · false edgeIreturn