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.
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.
- Input C code
- 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.
- 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) 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
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.
- 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.
- 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.
- Frontend How does your source get into the model?Partial
Frama-C's own C parser and normalizer, not the compiler's front end.
- 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.
- 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.
What it can prove
Kinds of guarantees, not how easy they are to get.
| Feature | Support | Notes |
|---|---|---|
| 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
| Feature | Support | Notes |
|---|---|---|
| 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
| Feature | Support | Notes |
|---|---|---|
| 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.
- 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
- 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
- WP Plug-in Manual for Frama-C 33.0 (Arsenic) · accessed 26 Nov 2026
- Frama-C User Manual for Frama-C 33.0 (Arsenic) · accessed 26 Nov 2026
- WP plug-in page · accessed 26 Nov 2026
- Admit and check annotations in ACSL · accessed 26 Nov 2026
- Get Frama-C · accessed 26 Nov 2026
- frama-c 33.0 opam package (license LGPL-2.1-only) · accessed 26 Nov 2026
- Brahmi et al., Formalise to automate (Airbus, ERTS 2018) · accessed 26 Nov 2026
- Thales JavaCard VM verification (Frama-C Days 2024) · accessed 26 Nov 2026
- CEA-List, Towards the formal certification of security products (2024) · accessed 26 Nov 2026