# CBMC

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

- Kind: toolchain
- Verifies: 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).)
- Effort: Push-button — Run it on your code; little or no annotation.
- Stage: 1 (Usable)
- Trust: Checker partial, Semantics partial, Frontend partial, Binary gap weak, Escape hatches partial
- Licence: open-source, BSD-4-Clause
- Latest release: 6.11.0 (2026-08-21) https://github.com/diffblue/cbmc/releases/tag/cbmc-6.11.0
- Links: [homepage](https://www.cprover.org/cbmc/), [repo](https://github.com/diffblue/cbmc), [docs](https://diffblue.github.io/cbmc/), [paper](http://www-2.cs.cmu.edu/~svc/papers/view-publications-ckl2004.html), [tutorial](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/cbmc-tutorial.md)

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

| Step | Component | Assurance | Note |
|---|---|---|---|
| frontend | 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. |
| semantics | CBMC C memory and pointer model | trusted | Built into the tool; pointers are modeled as (object, offset) pairs. |
| translation | Loop unwinding and symbolic execution to a SAT/SMT formula | trusted |  |
| checker | SAT solver (MiniSat 2 by default) or SMT solver (Z3, cvc5, Bitwuzla and others) (`z3`) | trusted | The ref points to Z3, one of several selectable back ends; the default in CMake builds is MiniSat 2. |
| compiler | gcc / clang (not part of CBMC) | trusted |  |

## Trust

| Axis | Level | Summary | Note |
|---|---|---|---|
| Checker | Partial (amber) | 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](https://github.com/diffblue/cbmc/blob/develop/CMakeLists.txt) |
| Semantics | Partial (amber) | 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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/modeling-pointers.md) |
| Frontend | Partial (amber) | CBMC's own C/C++ parser (goto-cc), not the compiler that builds the binary. |  [source](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/goto-cc.md) |
| Binary gap | Weak (red) | The binary comes from gcc or clang, which are not verified. |  |
| Escape hatches | Partial (amber) | __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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/unsound_options.md) |

## What it can prove

| Property | Support |
|---|---|
| No undefined behavior | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/src/ansi-c/goto-conversion/goto_check_c.h)) |
| Functional correctness | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/src/goto-instrument/contracts/doc/user/contracts-loops.md)) |
| Equivalence | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/README.md)) |
| Information flow | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/modeling-shadow-memory.md)) |
| Concurrency | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/api.md)) |
| Termination and liveness | Partial — Unwinding assertions show that loops finish within the given bound. Proving termination of unbounded loops needs loop contracts with a decreases clause. ([source](https://github.com/diffblue/cbmc/blob/develop/src/goto-instrument/contracts/doc/user/contracts-loops.md)) |

## Common features

| Feature | Support |
|---|---|
| Machine integers | Supported — Bit-precise machine integers. ([source](https://discovery.ucl.ac.uk/10131088/1/spe.2949.pdf)) |
| Floating point | Supported — Bit-accurate IEEE 754 for float and double. The math library has very limited support for elementary functions such as sin or exp. ([source](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/modeling-floating-point.md)) |
| Heap and pointers | Supported — malloc/free are modeled; malloc may return NULL by default since 6.0; use-after-free and double free are checked. ([source](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/modeling-pointers.md)) |
| Arrays and buffers | Supported ([source](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/properties.md)) |
| Loops | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/cbmc-unwinding.md)) |
| Recursion | Partial — Recursion is unrolled up to the bound like loops; function contracts can replace recursive calls. ([source](https://github.com/diffblue/cbmc/blob/develop/regression/cbmc/Recursion1/test.desc)) |
| Higher-order code | Supported — Calls through function pointers become a case split over all functions of a matching type; every possible target must be in the model. ([source](https://github.com/diffblue/cbmc/blob/develop/doc/architectural/goto-program-transformations.md)) |
| Threads and shared memory | Partial — Bounded exploration of thread interleavings only; no unbounded proofs for concurrent code. ([source](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/api.md)) |
| I/O and system calls | Partial — 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](https://github.com/diffblue/cbmc/pull/8292)) |
| Standard library | Partial — 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](https://github.com/diffblue/cbmc/tree/develop/src/ansi-c/library)) |

## C-specific features

| Feature | Support |
|---|---|
| Pointer casts and provenance | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/modeling-pointers.md)) |
| Unions and type punning | Supported — Byte-level memory model; reading a union through another member (including float/integer punning) is covered by the regression suite. ([source](https://github.com/diffblue/cbmc/tree/develop/regression/cbmc/union-double-bits-fpa)) |
| Bit-fields | Supported ([source](https://github.com/diffblue/cbmc/tree/develop/regression/cbmc/Bitfields1)) |
| Variadic functions | Supported ([source](https://github.com/diffblue/cbmc/tree/develop/regression/cbmc/Variadic1)) |
| setjmp / longjmp | Not supported — The built-in longjmp model is a failing assertion ("longjmp requires instrumentation"), so code that reaches longjmp cannot be verified as is. ([source](https://github.com/diffblue/cbmc/blob/develop/src/ansi-c/library/setjmp.c)) |
| volatile and MMIO | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/modeling-mmio.md)) |
| Inline assembly | Partial — 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](https://github.com/diffblue/cbmc/blob/develop/src/assembler/remove_asm.cpp)) |

## C++-specific features

| Feature | Support |
|---|---|
| Classes and virtual calls | Partial — Classes, inheritance and virtual calls are handled by the C++ front end, but the maintainers describe C++ support as spotty. ([source](https://github.com/diffblue/cbmc/issues/8663)) |
| Templates | Partial — 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](https://github.com/diffblue/cbmc/pull/8878)) |
| Constructors and destructors | Partial — Constructors and destructors are in the regression suite; overall C++ support is described as spotty. ([source](https://github.com/diffblue/cbmc/issues/8663)) |
| Exceptions | Unknown — The README lists exceptions among the things CBMC can check, but how much of C++ throw/catch is supported is not documented. ([source](https://github.com/diffblue/cbmc/blob/develop/README.md)) |
| Standard library (STL) | Partial — 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](https://github.com/diffblue/cbmc/issues/8663)) |
| Lambdas | Unknown — Lambda parsing is listed as new work in an open front-end pull request, which suggests released versions lack it; not confirmed. ([source](https://github.com/diffblue/cbmc/pull/8878)) |

## Stage

**Stage 1: Usable.**

| Stage | Criterion | Met | Evidence / note |
|---|---|---|---|
| 0 | Publicly available | yes | [evidence](https://github.com/diffblue/cbmc) |
| 0 | At least one published verification uses it | yes | [evidence](https://discovery.ucl.ac.uk/10131088/1/spe.2949.pdf) Chong et al., memory-safety proofs of AWS C Common and other AWS libraries (Software: Practice and Experience, 2021). |
| 1 | Released or updated in the last 12 months | yes | [evidence](https://github.com/diffblue/cbmc/releases/tag/cbmc-6.11.0) Latest release: 6.11.0, 2026-08-21. |
| 1 | Installs and runs on current platforms | yes | [evidence](https://github.com/diffblue/cbmc/releases/tag/cbmc-6.11.0) Packages for Ubuntu 24.04, Windows and macOS (Homebrew), plus a container image. |
| 1 | User documentation or tutorial | yes | [evidence](https://diffblue.github.io/cbmc/) |
| 1 | Used by a group other than its authors | yes | [evidence](https://www-i2.moves.rwth-aachen.de/i2/pdfs/1699.pdf) RWTH Aachen master's thesis (2019) evaluating CBMC on two embedded C programs from Ford. |
| 2 | Verified code in production at two or more independent organizations | no | 1 recorded: Amazon Web Services. |
| 2 | Checker axis is not red | yes |  |
| 2 | Semantics axis is not red | yes |  |
| 2 | Public channel for soundness bugs | yes | [evidence](https://github.com/diffblue/cbmc/labels/soundness) Public GitHub issues with a "soundness" label. |

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

## In production
- Amazon Web Services: Initial boot code running in AWS data centers proved memory safe with CBMC. ([source](https://ora.ox.ac.uk/objects/uuid:a4566b04-ad64-4bed-9bbe-20b5a4d98c2d))

## Projects
- [Memory safety of AWS C Common (proofs in the aws-c-common repository)](https://discovery.ucl.ac.uk/10131088/1/spe.2949.pdf)
- [Memory safety of boot code in AWS data centers](https://ora.ox.ac.uk/objects/uuid:a4566b04-ad64-4bed-9bbe-20b5a4d98c2d)

## Sources
- [CBMC changelog (6.0.0 default checks and unwinding assertions)](https://github.com/diffblue/cbmc/blob/develop/CHANGELOG)
- [CBMC default analysis flags](https://github.com/diffblue/cbmc/blob/develop/src/cbmc/cbmc_parse_options.cpp)
- [Understanding loop unwinding](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/cbmc-unwinding.md)
- [Unsound CLI options](https://github.com/diffblue/cbmc/blob/develop/doc/cprover-manual/unsound_options.md)
- [Loop contracts](https://github.com/diffblue/cbmc/blob/develop/src/goto-instrument/contracts/doc/user/contracts-loops.md)
- [C++ standard library and language version support (issue)](https://github.com/diffblue/cbmc/issues/8663)
- [Chong et al., Code-level model checking in the software development workflow at AWS](https://discovery.ucl.ac.uk/10131088/1/spe.2949.pdf)
- [Cook et al., Model checking boot code from AWS data centers (CAV 2018)](https://ora.ox.ac.uk/objects/uuid:a4566b04-ad64-4bed-9bbe-20b5a4d98c2d)
- [CBMC homepage](https://www.cprover.org/cbmc/)

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