C++
Also known as CXX
C with classes, templates and a large standard library; used for databases, browsers, games and high-performance code.
What do you want to prove about your C++ code?
Where proofs can attach
Toolchains that verify C++ directly, and those that verify what it compiles to. A proof about compiled code also relies on the compiler that produced it.
- Your code
- Intermediate code Proofs here are about the code the compiler produced
- Machine code Proofs here are about the binary itself
Verify C++ directly
Ranked by stage, feature coverage and trust.
| Toolchain | Stage | Trust | Effort | Feature coverage |
|---|---|---|---|---|
| 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. | Stage 1 · Usable | 0/5 | Push-button | 5/16full, 9 partial |
| BRiCk Prove concurrent C++ code correct in the Rocq proof assistant, using a separation logic for C++ built on Iris. | Stage 0 · Research | 1/5 | Interactive | 3/16full, 11 partial |
Verify the compiled code
These prove facts about what the compiler produced, not about your source.
| Toolchain | Stage | Trust | Effort | Path |
|---|---|---|---|---|
| s2n-bignum Prove hand-written x86-64 or Arm64 assembly correct in HOL Light, on the exact bytes of the built object file; used for AWS's cryptography code. | Stage 1 · Usable | 4/5 | Interactive | LLVM IR (clang, trusted) → x86-64 (LLVM backend (llc), trusted) |
| Alive2 Automatically checks that an optimized LLVM IR function still behaves like the original, or shows a counterexample. Loops are checked only up to a set bound. | Stage 1 · Usable | 1/5 | Push-button | LLVM IR (clang, trusted) |
| Islaris Prove Arm or RISC-V machine code correct in Rocq, against the full official Sail ISA models, using Isla symbolic execution and an Iris separation logic. | Stage 0 · Research | 2/5 | Interactive | LLVM IR (clang, trusted) → AArch64 (LLVM backend (llc), trusted) |
| LNSym Prove Armv8 (AArch64) machine code correct in Lean 4 by symbolic simulation over a hand-written model; aimed at AWS-LC cryptographic routines. | Stage 0 · Research | 2/5 | Interactive | LLVM IR (clang, trusted) → AArch64 (LLVM backend (llc), trusted) |
Feature coverage
Which language features each toolchain handles. Hover or focus a mark for the note and source. Toolchains on compiled code are shown for common features only.
| Feature | CBMC | BRiCk | s2n-bignum via x86-64 | Alive2 via LLVM IR | Islaris via AArch64 | LNSym via AArch64 |
|---|---|---|---|---|---|---|
| Common features | ||||||
| Machine integersFixed-width integer arithmetic, overflow and bit operations. | CBMC, Machine integers: Supported.Bit-precise machine integers. Source | BRiCk, Machine integers: Supported.All integer types are modeled by size and signedness; the sizes come from the Clang target used to generate the syntax tree. Source | s2n-bignum, Machine integers: Unknown. | Alive2, Machine integers: Supported.Integers are encoded as SMT bit-vectors, including the nsw/nuw overflow flags. Source | Islaris, Machine integers: Unknown. | LNSym, Machine integers: Unknown. |
| Floating pointIEEE 754 floating-point arithmetic, including rounding and NaNs. | CBMC, 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 | BRiCk, Floating point: Partial.IEEE-754 half, single, double and quad precision are supported (semantics from the Flocq library); x87 long double is not. Source | s2n-bignum, Floating point: Unknown. | Alive2, Floating point: Partial.IEEE-754 operations map to SMT floating-point theory (half, bfloat, float, double, fp128). Not supported: x86 80-bit and PowerPC double-double types. The 2021 paper notes that LLVM's frem rounds differently from SMT's remainder. Source | Islaris, Floating point: Unknown. | LNSym, Floating point: Unknown. |
| Heap and pointersDynamically allocated memory, pointers or references, and aliasing. | CBMC, 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 | BRiCk, Heap and pointers: Supported.new, delete, pointers and pointer provenance are modeled; reinterpret_cast has no rule yet. Source | s2n-bignum, Heap and pointers: Unknown. | Alive2, Heap and pointers: Partial.Byte-level memory model with blocks and pointer provenance (CAV 2021 encoding). The 2021 paper's stated limitation: it assumes calls do not modify local variables whose address has escaped. Volatile and atomic accesses are unsupported. Source | Islaris, Heap and pointers: Unknown. | LNSym, Heap and pointers: Unknown. |
| Arrays and buffersIndexed memory such as arrays, slices, vectors and byte buffers. | CBMC, Arrays and buffers: Supported. Source | BRiCk, Arrays and buffers: Partial.Arrays are supported, but implicit copy assignment of byte arrays gets stuck. Variable-length arrays and flexible array members (compiler extensions) are not supported. Source | s2n-bignum, Arrays and buffers: Unknown. | Alive2, Arrays and buffers: Supported.Memory blocks are modeled as SMT arrays of bytes, so arrays and buffers are supported. Source | Islaris, Arrays and buffers: Unknown. | LNSym, Arrays and buffers: Unknown. |
| LoopsUnbounded loops, which need invariants or bounds to verify. | CBMC, 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 | BRiCk, Loops: Supported.You write loop invariants by hand. Source | s2n-bignum, Loops: Unknown. | Alive2, Loops: Partial.Loops are unrolled up to a bound (-src-unroll and -tgt-unroll). The default bound is 0: any jump back to an already visited block is cut, so only paths that never repeat a loop body are compared. Bugs that need more iterations are missed. Source | Islaris, Loops: Unknown. | LNSym, Loops: Unknown. |
| RecursionFunctions that call themselves, directly or through others. | CBMC, Recursion: Partial.Recursion is unrolled up to the bound like loops; function contracts can replace recursive calls. Source | BRiCk, Recursion: Unknown.The documentation we found does not discuss recursive functions. | s2n-bignum, Recursion: Unknown. | Alive2, Recursion: Partial.Each function is checked on its own, and calls (recursive or not) are treated as calls to an unknown function. Transformations that change behavior across function boundaries are not supported. Source | Islaris, Recursion: Unknown. | LNSym, Recursion: Unknown. |
| Higher-order codeFunction pointers, closures and callbacks. | CBMC, 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 | BRiCk, Higher-order code: Partial.Calls through function pointers are supported; calls through member function pointers have no rule. Source | s2n-bignum, Higher-order code: Unknown. | Alive2, Higher-order code: Partial.Current code translates indirect calls through function pointers as calls to unknown functions. The 2021 paper still listed function pointers as unsupported. No source found on how precisely the target function is tracked. Source | Islaris, Higher-order code: Unknown. | LNSym, Higher-order code: Unknown. |
| Threads and shared memoryConcurrent threads with locks, atomics or message passing. | CBMC, Threads and shared memory: Partial.Bounded exploration of thread interleavings only; no unbounded proofs for concurrent code. Source | BRiCk, Threads and shared memory: Partial.Threads and atomics are supported, but every atomic access must be sequentially consistent. Compare-exchange works on integers, not pointers. Source | s2n-bignum, Threads and shared memory: Unknown. | Alive2, Threads and shared memory: Not supported.Atomic instructions and fences are rejected as unsupported. Source | Islaris, Threads and shared memory: Unknown. | LNSym, Threads and shared memory: Unknown. |
| I/O and system callsFiles, network, system calls and foreign-function calls. | CBMC, 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 | BRiCk, I/O and system calls: Partial.No built-in model of I/O or system calls. You give specifications for the outside functions you call; brick-libcpp has some, for example for parts of iostream and pthread mutexes. Source | s2n-bignum, I/O and system calls: Unknown. | Alive2, I/O and system calls: Partial.External calls are modeled as unknown functions that may change any memory. The 2021 paper names missing semantics for some string and I/O library functions as a common reason functions were skipped. Source | Islaris, I/O and system calls: Unknown. | LNSym, I/O and system calls: Unknown. |
| Standard librarySpecifications or models for the language's standard library. | CBMC, 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 | BRiCk, Standard library: Partial.brick-libcpp specifies parts of the standard library (mutexes, atomics, vector, string and others). It is work in progress, and building it needs SkyLabs AI's licensed automation. Source | s2n-bignum, Standard library: Unknown. | Alive2, Standard library: Partial.As of the 2021 paper, 117 C library functions had special semantics, some only partly. Others are treated as unknown calls. Source | Islaris, Standard library: Unknown. | LNSym, Standard library: Unknown. |
| C++-specific features | ||||||
| Classes and virtual callsInheritance, virtual functions and dynamic dispatch. | CBMC, 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 | BRiCk, Classes and virtual calls: Partial.Classes, inheritance and virtual calls are supported. Virtual inheritance is not; classes with bit-fields are opaque; member pointer operators have no rule; dynamic_cast and typeid are partial. Source | · | · | · | · |
| TemplatesGeneric code instantiated at compile time. | CBMC, 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 | BRiCk, Templates: Partial.Only instantiated templates can be verified, one instantiation at a time. Template parameter packs and unresolved concepts are not supported. Source | · | · | · | · |
| Constructors and destructorsObject lifetimes, RAII and destructor ordering. | CBMC, Constructors and destructors: Partial.Constructors and destructors are in the regression suite; overall C++ support is described as spotty. Source | BRiCk, Constructors and destructors: Partial.Constructors, destructors and implicit destruction are modeled. Lifetime-extended temporaries are not supported, and initialization of globals and function-local statics is not covered. Source | · | · | · | · |
| Exceptionsthrow, catch and stack unwinding. | CBMC, 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 | BRiCk, Exceptions: Not supported.throw and try are not supported, and every function call is assumed not to throw. Source | · | · | · | · |
| Standard library (STL)Containers, iterators and algorithms from the C++ standard library. | CBMC, 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 | BRiCk, Standard library (STL): Partial.Specifications for parts of the standard library are in brick-libcpp, which is work in progress. Source | · | · | · | · |
| LambdasAnonymous functions with captures. | CBMC, 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 | BRiCk, Lambdas: Partial.cpp2v translates lambdas, but the documentation does not describe their rules, and lambda types at global scope are dropped as unsupported. Source | · | · | · | · |
Supported Partial Not supported Unknown
Formal semantics of C++
Models that proofs about C++ can be stated against. See formal semanticsFormal semantics. A precise, mathematical definition of what programs in a language do..
- BRiCk C++ semantics Stage 0 · Mechanized
A separation-logic semantics of a large part of C++, written as weakest-precondition rules in Rocq on top of Iris. It is the model behind the BRiCk toolchain.
Compilers from C++
What each compilation step preserves, and whether it is proved.