Toolchain verifies C

Frama-C WP

Also known as Frama-C/WP, WP plug-in

Write ACSL contracts and loop invariants as comments in your C code; Frama-C's WP plug-in turns them into proof goals for SMT solvers.

Stage 1 · Usable Auto-active Open source · LGPL-2.1-only 33.0 (Arsenic) · 4 months ago
Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial CheckerSemanticsFrontendBinary gapEscape hatches 0 of 5 strong, 1 weak

Use it if

  • You write or maintain C code and can annotate it with contracts (pre- and postconditions) and loop invariants.
  • You need proofs that hold for all inputs, not just up to a bound, for example for certification (DO-178C, Common Criteria).
  • Your code is mostly plain integer and pointer code without heavy casting.

Look elsewhere if

  • Your code relies on unions, type punning, casts between pointer types or byte-level memory tricks.
  • Your code uses threads or shared memory.
  • Your code is heavy on floating point and you need precise numeric results; automatic provers rarely succeed there.

How it works

From your code to an accepted proof. Each step either has to be trusted or is checked by something else.

  1. Input
    C code
  2. Front end
    Frama-C kernel (C parser, normalizer and bundled libc headers) Trusted Frama-C's own front end; by default it uses its own standard-library headers instead of the system ones.
  3. Translation
    RTE plug-in Trusted Adds an assertion before each operation that could cause a runtime error (run with -wp-rte).
  4. Translation
    WP (weakest-precondition calculus, memory models, Qed simplifier) Trusted Default model is Typed+var+int+float.
  5. Checker
    Alt-Ergo (default) or other SMT solvers via Why3 (Z3, cvc5) Trusted
  6. Checker
    Rocq (Coq) Trusted Optional; for goals the SMT solvers cannot prove, checked interactively in Rocq.
  7. Compiler
    Any C compiler, e.g. gcc or clang (not part of Frama-C) Trusted

Verified or checked: outside the trusted base Validated per run or by tests Trusted without proof

  • C: Code must parse with Frama-C's front end. Loops built with goto (non-natural loops) are not supported since Frama-C 23.

Trust

What a proof from this toolchain relies on: the trusted computing baseTrusted computing base (TCB). Everything that must be correct for a proof to mean what it says., one part at a time. How these are rated.

  1. Checker What has the final word on a proof?
    Partial

    Alt-Ergo or another SMT solver via Why3 is trusted; no proof certificates.

    WP's own simplifier (Qed) is also trusted. Goals can instead be proved in Rocq (Coq), whose kernel then checks them.

    source

  2. Semantics Is the tool's model of the language the real language?
    Partial

    C model built into Frama-C and WP's memory models; no published validation found.

    Some non-default options are unsound by design (Typed with unlimited casts, the real-number float model, -wp-no-volatile); the defaults avoid them.

    source

  3. Frontend How does your source get into the model?
    Partial

    Frama-C's own C parser and normalizer, not the compiler's front end.

    source

  4. Binary gap Does the proof cover what actually runs?
    Weak

    The binary comes from an ordinary C compiler; the proof does not carry down to it.

  5. Escape hatches Can a proof silently rest on unchecked assumptions?
    Partial

    admit, axioms and assumed libc contracts exist; the Report plug-in lists them.

    admit and axiom generate no proof goal, and contracts of functions without bodies are assumed. Report marks these "considered valid", but a property that depends on them can still show as "surely valid", and the manual says dependency tracking is neither correct nor complete. Optional smoke tests look for contradictory assumptions.

    source

What it can prove

Kinds of guarantees, not how easy they are to get.

Properties
FeatureSupportNotes
No undefined behavior Memory safety and absence of runtime errors: no out-of-bounds access, use-after-free, overflow traps, panics or undefined behavior on any input allowed by the precondition. PartialPartial.With -wp-rte, the RTE plug-in adds assertions for runtime errors such as invalid memory access and arithmetic overflow, and WP proves them for all inputs. Guards for pointer alignment and for calls through invalid function pointers are skipped, and code outside the memory model (for example heterogeneous pointer casts) cannot be handled.
Source
With -wp-rte, the RTE plug-in adds assertions for runtime errors such as invalid memory access and arithmetic overflow, and WP proves them for all inputs. Guards for pointer alignment and for calls through invalid function pointers are skipped, and code outside the memory model (for example heterogeneous pointer casts) cannot be handled. source
Functional correctness The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”. SupportedSupported.ACSL contracts with pre/postconditions, behaviors and ghost code.
Source
ACSL contracts with pre/postconditions, behaviors and ghost code. source
Equivalence Two programs (an optimized and a reference version, or code before and after a change) are proved to behave the same, or one refines the other. PartialPartial.WP proves one function against one contract. Relating two programs (such as an optimized and a reference version) needs the separate research plug-in RPP, which uses self-composition on top of WP.
Source
WP proves one function against one contract. Relating two programs (such as an optimized and a reference version) needs the separate research plug-in RPP, which uses self-composition on top of WP. source
Information flow Secrets do not influence public outputs, timing or memory access patterns (constant-time code, non-interference). Not supportedNot supported.WP has no built-in support. Non-interference can be stated with the separate RPP plug-in, and Frama-C's SecureFlow tool targets information flow, but neither is part of WP; constant-time is not covered.
Source
WP has no built-in support. Non-interference can be stated with the separate RPP plug-in, and Frama-C's SecureFlow tool targets information flow, but neither is part of WP; constant-time is not covered. source
Concurrency Correctness of code with threads or shared memory: absence of data races, deadlock freedom, linearizability of concurrent data structures. Not supportedNot supported.WP's manual describes no model of threads or atomics. Frama-C's Mthread tool analyzes concurrent code, but it is not part of WP.
Source
WP's manual describes no model of threads or atomics. Frama-C's Mthread tool analyzes concurrent code, but it is not part of WP. source
Termination and liveness Every run finishes, or the system keeps making progress (liveness). SupportedSupported.terminates and decreases clauses and loop variants generate termination goals, including for (mutually) recursive functions.
Source
terminates and decreases clauses and loop variants generate termination goals, including for (mutually) recursive functions. source

Language coverage

Which parts of C it handles. Hover or focus a mark for details.

Common features

Common features
FeatureSupportNotes
Machine integers Fixed-width integer arithmetic, overflow and bit operations. SupportedSupported.Machine-integer model by default; overflow and downcast checks are set by kernel -warn options or the RTE plug-in.
Source
Machine-integer model by default; overflow and downcast checks are set by kernel -warn options or the RTE plug-in. source
Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. PartialPartial.The default float model follows IEEE 754 and is sound, but the manual says automated provers give very little support for proving float properties. A "real" model exists but is unsound.
Source
The default float model follows IEEE 754 and is sound, but the manual says automated provers give very little support for proving float properties. A "real" model exists but is unsound. source
Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. PartialPartial.Pointers and aliasing are handled by the Typed memory model, but ACSL clauses for specifying allocation and deallocation are not implemented in WP.
Source
Pointers and aliasing are handled by the Typed memory model, but ACSL clauses for specifying allocation and deallocation are not implemented in WP. source
Arrays and buffers Indexed memory such as arrays, slices, vectors and byte buffers. SupportedSupported.
Source
source
Loops Unbounded loops, which need invariants or bounds to verify. SupportedSupported.Needs a loop invariant (and a variant for termination) for each loop. Loops built with goto are not supported.
Source
Needs a loop invariant (and a variant for termination) for each loop. Loops built with goto are not supported. source
Recursion Functions that call themselves, directly or through others. SupportedSupported.Recursive functions need a decreases clause when termination is required.
Source
Recursive functions need a decreases clause when termination is required. source
Higher-order code Function pointers, closures and callbacks. PartialPartial.A function pointer must be provably equal to one of a finite set of known functions (ACSL calls extension); function contracts cannot yet be passed through pointers.
Source
A function pointer must be provably equal to one of a finite set of known functions (ACSL calls extension); function contracts cannot yet be passed through pointers. source
Threads and shared memory Concurrent threads with locks, atomics or message passing. Not supportedNot supported.No model of threads or shared-memory concurrency in WP.
Source
No model of threads or shared-memory concurrency in WP. source
I/O and system calls Files, network, system calls and foreign-function calls. PartialPartial.I/O and system calls are described only by ACSL contracts in Frama-C's bundled libc, which are assumed, not proved, and cover a subset of POSIX.
Source
I/O and system calls are described only by ACSL contracts in Frama-C's bundled libc, which are assumed, not proved, and cover a subset of POSIX. source
Standard library Specifications or models for the language's standard library. PartialPartial.Frama-C bundles a libc with ACSL specifications that the user manual calls incomplete and part of the trusted computing base.
Source
Frama-C bundles a libc with ACSL specifications that the user manual calls incomplete and part of the trusted computing base. source

C-specific features

C-specific features
FeatureSupportNotes
Pointer casts and provenance Casting between pointers and integers, pointer arithmetic across objects. PartialPartial.The default Typed model forbids casts between unrelated pointer types (for example reading an int through a char pointer). The option for unlimited casts is unsound; the byte-level model is experimental.
Source
The default Typed model forbids casts between unrelated pointer types (for example reading an int through a char pointer). The option for unlimited casts is unsound; the byte-level model is experimental. source
Unions and type punning Reading a value through a different type than it was written with. PartialPartial.The manual lists bytes, unions and casts as a hard open limitation; only the experimental Bytes and Region models give byte-level access.
Source
The manual lists bytes, unions and casts as a hard open limitation; only the experimental Bytes and Region models give byte-level access. source
Bit-fields Struct members narrower than a byte. UnknownUnknown.The WP manual does not discuss bit-fields. The WP manual does not discuss bit-fields.
Variadic functions Functions such as printf that take a variable number of arguments. PartialPartial.The Variadic plug-in (on by default) rewrites variadic functions and calls into fixed-argument ones; printf/scanf calls with a non-constant format string are not translated.
Source
The Variadic plug-in (on by default) rewrites variadic functions and calls into fixed-argument ones; printf/scanf calls with a non-constant format string are not translated. source
setjmp / longjmp Non-local jumps out of nested calls. Not supportedNot supported.A 2024 Thales/CEA presentation on WP lists setjmp/longjmp among C features still to be handled.
Source
A 2024 Thales/CEA presentation on WP lists setjmp/longjmp among C features still to be handled. source
volatile and MMIO Memory-mapped device registers and volatile accesses. PartialPartial.By default a volatile read gives an arbitrary value and a write is treated as an assigns clause; device behavior is not modeled.
Source
By default a volatile read gives an arbitrary value and a write is treated as an assigns clause; device behavior is not modeled. source
Inline assembly Assembly code embedded in C functions. PartialPartial.For extended GNU asm, Frama-C generates assigns clauses from the output operands; what the assembly computes is not modeled and must be specified by hand.
Source
For extended GNU asm, Frama-C generates assigns clauses from the output operands; what the assembly computes is not modeled and must be specified by hand. source

Stage

Computed from the evidence below; see the criteria. 1criterion is missing for Stage 2.

Stage 0 Research Met
  • Met: Publicly available evidence
  • Met: At least one published verification uses it Airbus (ERTS 2018): unit proof of avionics C functions with Frama-C/WP and Alt-Ergo. evidence
Stage 1 Usable Met
  • Met: Released or updated in the last 12 months Latest release: 33.0 (Arsenic), 2026-07-23. evidence
  • Met: Installs and runs on current platforms Installers for Linux and macOS; opam for Linux, macOS and Windows (WSL). evidence
  • Met: User documentation or tutorial evidence
  • Met: Used by a group other than its authors Airbus and Thales (not the CEA-List developers) report using WP. evidence
Stage 2 Production Next
  • Not met: Verified code in production at two or more independent organizations 1 recorded: Thales.
  • Met: Checker axis is not red
  • Met: Semantics axis is not red
  • Met: Public channel for soundness bugs Issue tracker on the Frama-C GitLab (sign in, for example with a GitHub account, to view and file issues); reports can be public or confidential. evidence

In use

Verified code in production, and notable verification projects.

In production

  • Thales Java Card virtual machine for smart cards, verified with Frama-C (WP and MetAcsl); this work enabled Common Criteria EAL7 certification. source

Facts and sources

Effort
Auto-active: You write specifications and hints; a solver does the proving.
Licence
Open source, LGPL-2.1-only
Maintained by
CEA-List
Latest release
33.0 (Arsenic) (23 Jul 2026) source
Last checked
26 Nov 2026

Further sources

esc