# Frama-C WP

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

- Kind: toolchain
- Verifies: C (Code must parse with Frama-C's front end. Loops built with goto (non-natural loops) are not supported since Frama-C 23.)
- Effort: Auto-active — You write specifications and hints; a solver does the proving.
- Stage: 1 (Usable)
- Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial
- Licence: open-source, LGPL-2.1-only
- Latest release: 33.0 (Arsenic) (2026-07-23) https://git.frama-c.com/pub/frama-c/-/tags/33.0
- Links: [homepage](https://frama-c.com/fc-plugins/wp.html), [repo](https://git.frama-c.com/pub/frama-c), [docs](https://frama-c.com/download/frama-c-wp-manual.pdf), [tutorial](https://allan-blanchard.fr/publis/frama-c-wp-tutorial-en.pdf)

## 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 (pipeline)

| Step | Component | Assurance | Note |
|---|---|---|---|
| frontend | 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. |
| translation | RTE plug-in | trusted | Adds an assertion before each operation that could cause a runtime error (run with -wp-rte). |
| translation | WP (weakest-precondition calculus, memory models, Qed simplifier) | trusted | Default model is Typed+var+int+float. |
| checker | Alt-Ergo (default) or other SMT solvers via Why3 (Z3, cvc5) | trusted |  |
| checker | Rocq (Coq) (`rocq`) | trusted | Optional; for goals the SMT solvers cannot prove, checked interactively in Rocq. |
| compiler | Any C compiler, e.g. gcc or clang (not part of Frama-C) | trusted |  |

## Trust

| Axis | Level | Summary | Note |
|---|---|---|---|
| Checker | Partial (amber) | 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](https://frama-c.com/download/frama-c-wp-manual.pdf) |
| Semantics | Partial (amber) | 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](https://frama-c.com/download/frama-c-wp-manual.pdf) |
| Frontend | Partial (amber) | Frama-C's own C parser and normalizer, not the compiler's front end. |  [source](https://frama-c.com/download/frama-c-user-manual.pdf) |
| Binary gap | Weak (red) | The binary comes from an ordinary C compiler; the proof does not carry down to it. |  |
| Escape hatches | Partial (amber) | 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](https://frama-c.com/download/frama-c-user-manual.pdf) |

## What it can prove

| Property | Support |
|---|---|
| No undefined behavior | Partial — 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](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Functional correctness | Supported — ACSL contracts with pre/postconditions, behaviors and ghost code. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Equivalence | Partial — 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](https://arxiv.org/abs/1801.06876v2)) |
| Information flow | Not 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](https://frama-c.com/download/frama-c-user-manual.pdf)) |
| Concurrency | Not 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](https://frama-c.com/download/frama-c-user-manual.pdf)) |
| Termination and liveness | Supported — terminates and decreases clauses and loop variants generate termination goals, including for (mutually) recursive functions. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |

## Common features

| Feature | Support |
|---|---|
| Machine integers | Supported — Machine-integer model by default; overflow and downcast checks are set by kernel -warn options or the RTE plug-in. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Floating point | Partial — 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](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Heap and pointers | Partial — Pointers and aliasing are handled by the Typed memory model, but ACSL clauses for specifying allocation and deallocation are not implemented in WP. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Arrays and buffers | Supported ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Loops | Supported — Needs a loop invariant (and a variant for termination) for each loop. Loops built with goto are not supported. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Recursion | Supported — Recursive functions need a decreases clause when termination is required. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Higher-order code | Partial — 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](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Threads and shared memory | Not supported — No model of threads or shared-memory concurrency in WP. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| I/O and system calls | Partial — 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](https://frama-c.com/download/frama-c-user-manual.pdf)) |
| Standard library | Partial — Frama-C bundles a libc with ACSL specifications that the user manual calls incomplete and part of the trusted computing base. ([source](https://frama-c.com/download/frama-c-user-manual.pdf)) |

## C-specific features

| Feature | Support |
|---|---|
| Pointer casts and provenance | Partial — 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](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Unions and type punning | Partial — The manual lists bytes, unions and casts as a hard open limitation; only the experimental Bytes and Region models give byte-level access. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Bit-fields | Unknown — The WP manual does not discuss bit-fields. |
| Variadic functions | Partial — 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](https://frama-c.com/fc-plugins/variadic.html)) |
| setjmp / longjmp | Not supported — A 2024 Thales/CEA presentation on WP lists setjmp/longjmp among C features still to be handled. ([source](https://frama-c.com/download/publications/frama-c-days-2024/09-javacard.pdf)) |
| volatile and MMIO | Partial — By default a volatile read gives an arbitrary value and a write is treated as an assigns clause; device behavior is not modeled. ([source](https://frama-c.com/download/frama-c-wp-manual.pdf)) |
| Inline assembly | Partial — 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](https://frama-c.com/download/frama-c-user-manual.pdf)) |

## Stage

**Stage 1: Usable.**

| Stage | Criterion | Met | Evidence / note |
|---|---|---|---|
| 0 | Publicly available | yes | [evidence](https://git.frama-c.com/pub/frama-c) |
| 0 | At least one published verification uses it | yes | [evidence](https://www.di.ens.fr/~delmas/erts18/erts18-short.pdf) Airbus (ERTS 2018): unit proof of avionics C functions with Frama-C/WP and Alt-Ergo. |
| 1 | Released or updated in the last 12 months | yes | [evidence](https://git.frama-c.com/pub/frama-c/-/tags/33.0) Latest release: 33.0 (Arsenic), 2026-07-23. |
| 1 | Installs and runs on current platforms | yes | [evidence](https://frama-c.com/html/get-frama-c.html) Installers for Linux and macOS; opam for Linux, macOS and Windows (WSL). |
| 1 | User documentation or tutorial | yes | [evidence](https://frama-c.com/download/frama-c-wp-manual.pdf) |
| 1 | Used by a group other than its authors | yes | [evidence](https://www.di.ens.fr/~delmas/erts18/erts18-short.pdf) Airbus and Thales (not the CEA-List developers) report using WP. |
| 2 | Verified code in production at two or more independent organizations | no | 1 recorded: Thales. |
| 2 | Checker axis is not red | yes |  |
| 2 | Semantics axis is not red | yes |  |
| 2 | Public channel for soundness bugs | yes | [evidence](https://git.frama-c.com/pub/frama-c) 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. |

Missing for Stage 2: Verified code in production at two or more independent organizations.

## 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](https://list.cea.fr/en/towards-the-formal-certification-of-security-products/))

## Projects
- [Airbus unit proof of avionics software (replacing the older Caveat tool)](https://www.di.ens.fr/~delmas/erts18/erts18-short.pdf)
- [Thales Java Card virtual machine (about 8,000 lines of C, 80,000 proof goals)](https://frama-c.com/download/publications/frama-c-days-2024/09-javacard.pdf)

## Sources
- [WP Plug-in Manual for Frama-C 33.0 (Arsenic)](https://frama-c.com/download/frama-c-wp-manual.pdf)
- [Frama-C User Manual for Frama-C 33.0 (Arsenic)](https://frama-c.com/download/frama-c-user-manual.pdf)
- [WP plug-in page](https://frama-c.com/fc-plugins/wp.html)
- [Admit and check annotations in ACSL](https://frama-c.com/2021/06/10/acsl-admit-check.html)
- [Get Frama-C](https://frama-c.com/html/get-frama-c.html)
- [frama-c 33.0 opam package (license LGPL-2.1-only)](https://github.com/ocaml/opam-repository/tree/master/packages/frama-c/frama-c.33.0)
- [Brahmi et al., Formalise to automate (Airbus, ERTS 2018)](https://www.di.ens.fr/~delmas/erts18/erts18-short.pdf)
- [Thales JavaCard VM verification (Frama-C Days 2024)](https://frama-c.com/download/publications/frama-c-days-2024/09-javacard.pdf)
- [CEA-List, Towards the formal certification of security products (2024)](https://list.cea.fr/en/towards-the-formal-certification-of-security-products/)

---
Last checked 2026-11-26. Data: [JSON](/toolchains/frama-c-wp.json) · Page: [HTML](/toolchains/frama-c-wp/) · Methodology v0.1: [/methodology/](/methodology/) · Corrections: [/contribute/](/contribute/)
