Toolchain verifies C, C++

CBMC

Also known as C Bounded Model Checker, CProver

Write a test-like harness for your C code; CBMC checks every execution up to a loop bound, giving a counterexample or a bounded proof.

Stage 1 · Usable Push-button Open source · BSD-4-Clause 6.11.0 · 3 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 want memory safety and assertion checks on C code with small or known loop bounds, such as parsers, data structures or boot code.
  • You prefer writing test-like harnesses and assumptions over writing loop invariants.
  • You want a concrete counterexample trace whenever a check fails.

Look elsewhere if

  • Your loops have no small bound and you are not willing to write loop contracts; the result would only cover executions up to the bound.
  • Your code is mostly modern C++; the C++ front end is limited.
  • You need full functional correctness of complex algorithms; the solver often runs out of time or memory on large inputs.

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 / C++ code
  2. Front end
    goto-cc (CBMC's own C/C++ parser) Trusted A drop-in replacement for gcc that compiles C into CBMC's 'goto program' format; it is not the compiler that builds your binary.
  3. Semantics
    CBMC C memory and pointer model Trusted Built into the tool; pointers are modeled as (object, offset) pairs.
  4. Translation
    Loop unwinding and symbolic execution to a SAT/SMT formula Trusted
  5. Checker
    SAT solver (MiniSat 2 by default) or SMT solver (Z3, cvc5, Bitwuzla and others) Trusted The ref points to Z3, one of several selectable back ends; the default in CMake builds is MiniSat 2.
  6. Compiler
    gcc / clang (not part of CBMC) Trusted

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

  • C: Supports C89, C99, most of C11, C17, C23 and most gcc and Visual Studio extensions (README).
  • C++: A C++ front end exists, but in 2025 the maintainers called its support 'spotty'; a large rework is still an open pull request (#8878).

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

    A SAT or SMT solver decides; its answer is trusted and no proof certificate is kept.

    Default SAT solver in CMake builds is MiniSat 2; CaDiCaL and SMT solvers (Z3, cvc5, Bitwuzla, Yices, MathSAT) can be selected. CBMC's own symbolic execution and encoding are also trusted. Release 6.10 added a workaround for a soundness bug in older Z3 releases.

    source

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

    C model built into CBMC; tested by its own regression suite.

    Known simplifications: pointers to different objects are always distinct (the manual calls this not sound), and unknown inline assembly is ignored.

    source

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

    CBMC's own C/C++ parser (goto-cc), not the compiler that builds the binary.

    source

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

    The binary comes from gcc or clang, which are not verified.

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

    __CPROVER_assume, stubs and unsound flags exist; CBMC warns on unsound flags.

    Harness assumptions (__CPROVER_assume), hand-written stubs, --no-standard-checks and --no-unwinding-assertions can hide bugs. CBMC prints a warning for --unwind without unwinding assertions, --depth and other unsound options; assumptions in code are found by searching the source.

    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.Since CBMC 6.0 the default checks cover array bounds, pointer validity, pointer primitives, division by zero, signed overflow and over-wide shifts. Other checks (memory leaks, unsigned and pointer overflow, conversions, NaN) must be switched on. The result is a proof only up to the loop bounds (with unwinding assertions passing) or with loop contracts.
Source
Since CBMC 6.0 the default checks cover array bounds, pointer validity, pointer primitives, division by zero, signed overflow and over-wide shifts. Other checks (memory leaks, unsigned and pointer overflow, conversions, NaN) must be switched on. The result is a proof only up to the loop bounds (with unwinding assertions passing) or with loop contracts. source
Functional correctness The code meets a written specification of its results, for example “returns the sorted list” or “implements this RFC”. PartialPartial.You state properties as assertions in a harness or as function contracts. Checks hold for all inputs allowed by the harness, but only up to the loop bounds unless loop contracts are used.
Source
You state properties as assertions in a harness or as function contracts. Checks hold for all inputs allowed by the harness, but only up to the loop bounds unless loop contracts are used. 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.No dedicated equivalence mode for two C functions; you write a harness that runs both on the same nondeterministic inputs and asserts equal results, within the loop bounds. The README also mentions checking C against Verilog.
Source
No dedicated equivalence mode for two C functions; you write a harness that runs both on the same nondeterministic inputs and asserts equal results, within the loop bounds. The README also mentions checking C against Verilog. source
Information flow Secrets do not influence public outputs, timing or memory access patterns (constant-time code, non-interference). PartialPartial.No built-in non-interference or constant-time check. Symbolic shadow memory lets users build their own taint tracking (shown in the CBMC-SSM paper).
Source
No built-in non-interference or constant-time check. Symbolic shadow memory lets users build their own taint tracking (shown in the CBMC-SSM paper). source
Concurrency Correctness of code with threads or shared memory: absence of data races, deadlock freedom, linearizability of concurrent data structures. PartialPartial.Threads (pthreads or __CPROVER_ASYNC) are explored up to the unwinding bound; sequential consistency by default, with --mm and goto-instrument options for weak memory models and race checks. AWS reported that code using concurrency was outside the scope of their CBMC proofs.
Source
Threads (pthreads or __CPROVER_ASYNC) are explored up to the unwinding bound; sequential consistency by default, with --mm and goto-instrument options for weak memory models and race checks. AWS reported that code using concurrency was outside the scope of their CBMC proofs. source
Termination and liveness Every run finishes, or the system keeps making progress (liveness). PartialPartial.Unwinding assertions show that loops finish within the given bound. Proving termination of unbounded loops needs loop contracts with a decreases clause.
Source
Unwinding assertions show that loops finish within the given bound. Proving termination of unbounded loops needs loop contracts with a decreases clause. source

Language coverage

Which parts of C and 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.Bit-precise machine integers.
Source
Bit-precise machine integers. source
Floating point IEEE 754 floating-point arithmetic, including rounding and NaNs. SupportedSupported.Bit-accurate IEEE 754 for float and double. The math library has very limited support for elementary functions such as sin or exp.
Source
Bit-accurate IEEE 754 for float and double. The math library has very limited support for elementary functions such as sin or exp. source
Heap and pointers Dynamically allocated memory, pointers or references, and aliasing. SupportedSupported.malloc/free are modeled; malloc may return NULL by default since 6.0; use-after-free and double free are checked.
Source
malloc/free are modeled; malloc may return NULL by default since 6.0; use-after-free and double free are checked. 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. PartialPartial.Loops are unrolled up to a bound. Unwinding assertions (on by default since 6.0) fail if the bound is too small, so a passing run is a proof for all executions. Loops without a small bound need loop contracts (goto-instrument --apply-loop-contracts) for an unbounded proof.
Source
Loops are unrolled up to a bound. Unwinding assertions (on by default since 6.0) fail if the bound is too small, so a passing run is a proof for all executions. Loops without a small bound need loop contracts (goto-instrument --apply-loop-contracts) for an unbounded proof. source
Recursion Functions that call themselves, directly or through others. PartialPartial.Recursion is unrolled up to the bound like loops; function contracts can replace recursive calls.
Source
Recursion is unrolled up to the bound like loops; function contracts can replace recursive calls. source
Higher-order code Function pointers, closures and callbacks. SupportedSupported.Calls through function pointers become a case split over all functions of a matching type; every possible target must be in the model.
Source
Calls through function pointers become a case split over all functions of a matching type; every possible target must be in the model. source
Threads and shared memory Concurrent threads with locks, atomics or message passing. PartialPartial.Bounded exploration of thread interleavings only; no unbounded proofs for concurrent code.
Source
Bounded exploration of thread interleavings only; no unbounded proofs for concurrent code. source
I/O and system calls Files, network, system calls and foreign-function calls. PartialPartial.Many POSIX and C library calls have built-in models that mostly return nondeterministic values. Since 6.0 a call to a function with no body fails verification unless you add a stub.
Source
Many POSIX and C library calls have built-in models that mostly return nondeterministic values. Since 6.0 a call to a function with no body fails verification unless you add a stub. source
Standard library Specifications or models for the language's standard library. PartialPartial.CBMC ships models for parts of the C library (string, stdlib, stdio, pthread and others); coverage is not complete and the math library is limited.
Source
CBMC ships models for parts of the C library (string, stdlib, stdio, pthread and others); coverage is not complete and the math library is limited. source

C-specific features

C-specific features
FeatureSupportNotes
Pointer casts and provenance Casting between pointers and integers, pointer arithmetic across objects. PartialPartial.Pointers are (object, offset) pairs. The manual says converting a pointer to an integer is not supported, and integers cast to pointers are NULL or point into a special memory-mapped I/O region. Pointers to different objects are always treated as different, which the manual calls not sound.
Source
Pointers are (object, offset) pairs. The manual says converting a pointer to an integer is not supported, and integers cast to pointers are NULL or point into a special memory-mapped I/O region. Pointers to different objects are always treated as different, which the manual calls not sound. source
Unions and type punning Reading a value through a different type than it was written with. SupportedSupported.Byte-level memory model; reading a union through another member (including float/integer punning) is covered by the regression suite.
Source
Byte-level memory model; reading a union through another member (including float/integer punning) is covered by the regression suite. source
Bit-fields Struct members narrower than a byte. SupportedSupported.
Source
source
Variadic functions Functions such as printf that take a variable number of arguments. SupportedSupported.
Source
source
setjmp / longjmp Non-local jumps out of nested calls. Not supportedNot supported.The built-in longjmp model is a failing assertion ("longjmp requires instrumentation"), so code that reaches longjmp cannot be verified as is.
Source
The built-in longjmp model is a failing assertion ("longjmp requires instrumentation"), so code that reaches longjmp cannot be verified as is. source
volatile and MMIO Memory-mapped device registers and volatile accesses. PartialPartial.Memory-mapped I/O regions must be declared with __CPROVER_allocated_memory, and device behavior must be modeled by hand (for example by making reads nondeterministic).
Source
Memory-mapped I/O regions must be declared with __CPROVER_allocated_memory, and device behavior must be modeled by hand (for example by making reads nondeterministic). source
Inline assembly Assembly code embedded in C functions. PartialPartial.Only a few x86 and Arm instructions (fences, xchg, FPU control word) are translated. Other inline assembly is dropped without a warning, so its effects are silently ignored.
Source
Only a few x86 and Arm instructions (fences, xchg, FPU control word) are translated. Other inline assembly is dropped without a warning, so its effects are silently ignored. source

C++-specific features

C++-specific features
FeatureSupportNotes
Classes and virtual calls Inheritance, virtual functions and dynamic dispatch. PartialPartial.Classes, inheritance and virtual calls are handled by the C++ front end, but the maintainers describe C++ support as spotty.
Source
Classes, inheritance and virtual calls are handled by the C++ front end, but the maintainers describe C++ support as spotty. source
Templates Generic code instantiated at compile time. PartialPartial.Basic templates are in the regression suite; newer features (variadic templates, concepts, class template argument deduction) are part of an unmerged front-end rework.
Source
Basic templates are in the regression suite; newer features (variadic templates, concepts, class template argument deduction) are part of an unmerged front-end rework. source
Constructors and destructors Object lifetimes, RAII and destructor ordering. PartialPartial.Constructors and destructors are in the regression suite; overall C++ support is described as spotty.
Source
Constructors and destructors are in the regression suite; overall C++ support is described as spotty. source
Exceptions throw, catch and stack unwinding. UnknownUnknown.The README lists exceptions among the things CBMC can check, but how much of C++ throw/catch is supported is not documented.
Source
The README lists exceptions among the things CBMC can check, but how much of C++ throw/catch is supported is not documented. source
Standard library (STL) Containers, iterators and algorithms from the C++ standard library. PartialPartial.In a 2025 user test with CBMC 6.6, 10 of 100 minimal programs using standard headers passed; most C++11/14 headers failed to compile. A maintainer confirmed support is spotty.
Source
In a 2025 user test with CBMC 6.6, 10 of 100 minimal programs using standard headers passed; most C++11/14 headers failed to compile. A maintainer confirmed support is spotty. source
Lambdas Anonymous functions with captures. UnknownUnknown.Lambda parsing is listed as new work in an open front-end pull request, which suggests released versions lack it; not confirmed.
Source
Lambda parsing is listed as new work in an open front-end pull request, which suggests released versions lack it; not confirmed. 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 Chong et al., memory-safety proofs of AWS C Common and other AWS libraries (Software: Practice and Experience, 2021). evidence
Stage 1 Usable Met
  • Met: Released or updated in the last 12 months Latest release: 6.11.0, 2026-08-21. evidence
  • Met: Installs and runs on current platforms Packages for Ubuntu 24.04, Windows and macOS (Homebrew), plus a container image. evidence
  • Met: User documentation or tutorial evidence
  • Met: Used by a group other than its authors RWTH Aachen master's thesis (2019) evaluating CBMC on two embedded C programs from Ford. evidence
Stage 2 Production Next
  • Not met: Verified code in production at two or more independent organizations 1 recorded: Amazon Web Services.
  • Met: Checker axis is not red
  • Met: Semantics axis is not red
  • Met: Public channel for soundness bugs Public GitHub issues with a "soundness" label. evidence

In use

Verified code in production, and notable verification projects.

In production

  • Amazon Web Services Initial boot code running in AWS data centers proved memory safe with CBMC. source

Facts and sources

Effort
Push-button: Run it on your code; little or no annotation.
Licence
Open source, BSD-4-Clause
Maintained by
CProver developers (github.com/diffblue/cbmc)
Latest release
6.11.0 (21 Aug 2026) source
Last checked
26 Nov 2026

Further sources

esc