Formally verified compilation

CompCert is a formally verified optimizing C compiler. Its intended use is compiling safety-critical and mission-critical software written in C and meeting high levels of assurance. It ac­cepts most of the ISO C 99 language, with some exceptions and some extensions. It produces machine code for a growing number of different architectures.

What sets CompCert apart?

ACM Software System Award

CompCert is the only production compiler that is formally verified, using machine-assisted math­ematical proofs, to be exempt from mis­compilation issues. The code it pro­duces is proved to behave exactly as specified by the semantics of the source C program.

This level of confidence in the correctness of the compilation process is unprecedented and con­tributes to meeting the highest levels of software assurance.

CompCert diagram
verified with Rocqvalidated with Valex

The formal proof covers all transformations from the abstract syntax tree to the generated assem­bly code. To preprocess and produce object and executable files, an external C pre­processor, assemblers, linkers, and C libraries have to be used. However, these unverified stages are well-understood and robust from an implementation perspective. This was demon­strated on an early version of CompCert in a 2011 study by Regehr, Yang et al.:

We created a tool that generates random C programs, and then spent two and a half years using it to find compiler bugs. So far, we have reported more than 325 previously unknown bugs to compiler developers.


The striking thing about our CompCert results is that the middle-end bugs we found in all other compilers are absent.


As of early 2011, the under-development version of CompCert is the only compiler we have tested for which Csmith cannot find wrong-code errors. This is not for lack of trying: we have devoted about six CPU-years to the task.


The apparent unbreak­ability of CompCert supports a strong argument that developing compiler optimizations within a proof framework, where safety checks are explicit and machine-checked, has tangible be­ne­fits for compiler users.”

In 2022, the Association for Computing Machinery, ACM, presented the CompCert development team with the prestigious ACM Software System Award. Subsequently, the team also received the ACM SIGPLAN Programming Languages Software Award.

Your benefits

Formally verified optimizations

CompCert implements a variety of controlled non-aggressive optimizations, all of them formally verified:

Loop optimizations are currently not performed, but can be implemented on request.

Success stories

For over a decade now, Airbus France has been deploying CompCert at the Toulouse plant. Among other things, the compiler has helped meet performance-gain objectives by reducing the worst-case execution time of the targeted software.

The Institute of Flight System Dynamics at the Technical University of Munich uses CompCert in the development of flight control and navigation algorithms.

In 2017, CompCert was qualified by MTU Friedrichshafen according to IEC 60880, category A, and IEC 61508-3:2010, SCL 3 for a certification project in the nuclear energy domain. The switch to CompCert reduced development time and costs.

In 2026, CompCert was qualified for ATR 42/72 aircraft. CompCert deployment for critical avionics software gains certification credits for compliance with DO-178C, DO-333, and DO-330.

In the civil-aviation research project QSMA by the German Federal Ministry for Economic Affairs and Energy, CompCert was used to develop a TSO-C151b Terrain Avoid­ance and Warning System in accordance with DAL-C. The project was carried out in co-operation with the German Aerospace Center DLR.

Compilation with execution time in mind

On average, code generated by CompCert is:

Due to the lack of aggressive loop optimizations, performance is lower on benchmarks that involve many matrix computations.

CompCert benchmarks
Execution times of 13 benchmarks from the Mibench suite, compiled with:
GCC -O0 (baseline) GCC -O1 GCC -Os CompCert -O0 CompCert -O CompCert -Os

CompCert benchmarks
Execution times of 23 benchmarks from a homebrew suite, compiled with:
GCC -O0 (baseline) GCC -O1 GCC -O3 CompCert -O

CompCert benchmarks
Execution times of 23 benchmarks from another homebrew suite, compiled with:
GCC -O0 (baseline) GCC -O1 GCC -O2 CompCert

CompCert benchmarks
Evaluation on 9 benchmarks by X. Leroy, INRIA
GCC -O0 (baseline) GCC -O1 CompCert

CompCert benchmarks
Evaluation on 13 common cryptographic programs by G. Barthe et al., ACM Open Access
GCC -O0 (baseline) GCC -O1 GCC -O3 CompCert

CompCert benchmarks
Evaluation on SPEC benchmarks for PowerPC by D. Kästner et al., HAL open science
GCC -O0 (baseline) GCC -O1 GCC -O2 CompCert

CompCert benchmarks
Evaluation on proprietary code by MTU Friedrichshafen, ERTS 2018
Conventional compiler CompCert

With CompCert it is possible to decrease the execution time of our flight control algo­rithms by a sig­nif­icant amount. The reduction of the execution time can be used for additional functionality.”

TU Munich, Institute of Flight System Dynamics


Short-term need of performance: 11% WCET saving; performance gain with CompCert: 12% (so far)”

Airbus France


The computed WCET bounds lead to a total processor load which is about 28% smaller with the CompCert-generated code than with the code generated by the conventional compiler. The main reason for this behaviour is the improved memory performance. The result is consistent with our expectations and with previously published CompCert research papers.”

MTU Friedrichshafen

Ease-of-use and interoperability

A growing list of supported architectures and ABIs

ARM logoInfineon logoAltium logoNXP logoMilandr logoST Microelectronics logoSharp logoAMD logoIntel logoRISC-V logo

CompCert produces machine code for PowerPC, ARM & AArch64, x86, RISC-V, and AURIX.

Try now, for free

Start your free trial today.

Watch on YouTube

Introduction to CompCert

Video thumbnail

A 2021 recording of a joint webinar with Vector Informatik.

  • Terminology: Compiler validation vs. compiler verification
  • Introduction to formal compiler verification
  • Benefits of formally verified compilation
  • Experimental evaluation of CompCert performance
  • Tool qualification strategy for industry norms such as ISO 26262

ACM Software System Award 2021

Video thumbnail

The 2021 Award goes to the CompCert developer team:


Building blocks, not a black box

Thanks to the modularity of the formal proof, CompCert’s individual components — notably, its clightgen frontend for generating Clight — can be used separately, incorporated into other applications, and/or extended as need be.

Strong roots in academia

AbsInt was founded in 1998 at the Chair for Compiler Construction at the University of Saarland, Germany. CompCert is developed and distributed by AbsInt since 2015 under license from INRIA, the French National Institute for Research in Digital Science and Technology.

Using CompCert for educational and research purposes is free of charge.

Additionally, we offer free academic evaluations of all our tools for static analysis of C, C++, and binary code. Have a browse through our extensive catalog and get in touch if anything catches your eye.

Community voices

I have had the pleasure of visiting AbsInt and hearing talks on, amongst other things, CompCert. It really is a fascinating piece of software.”

anonymous, Hacker News

The best part about CompCert, IMO, is the interpreter it comes with. It can easily expose nasty undefined behaviors, and also explore unspecified evaluation orders.”

anonymous, r/programming

AbsInt’s involvement with CompCert is alluring; a project where engineering issues are handled in parallel with research questions seems to promise faster progress.”

Priya Srikumar

When I was writing my proposal to get into a PhD program, I had to do a crash course in formally verified applications. I became slightly obsessed with CompCert; it felt like a ‘real’ program that was utilizing proper formal verification techniques. It seemed so cool to me that there can be an ‘objectively correct’ version of a C compiler. I still think it’s very cool; I wish people would geek out about this stuff as much as I would sometimes.”

anonymous, Hacker News

CompCert isn‘t going to want to know about any code that doesn‘t pass gcc -Wall -Werror, but there are a few things LLVM thinks it‘s OK to warn you about that CompCert is cool with, which feels like LLVM is wasting my time.”

Martin Keegan

Most compiler bugs are not in their interpretation of the specifi­cation, but in various optimization passes. CompCert’s formal verification ensures that all optimizations retain semantics; that alone makes it worth whatever they’re charging.”

anonymous, Hacker News