Chapter 15 — Toolchain and flags¶
Tools¶
Tool |
Role |
|---|---|
|
Verify-only driver |
|
Parse contracts + verify (parallel) + compile |
|
Light check — contracts on, skip the solver |
Two axes¶
Contract behaviour is two independent switches (full reference and a quick-lookup table: Commands and flags):
Contract language —
-fverify-contracts/-fno-verify-contracts(default off). The master switch: enables the keywords and the codegen stripping. With it off, the file is plain C++ and the verifier never runs.Run the prover —
-fno-verify(the verifier runs by default once contracts are on). There is no-fverify— it would just be the default.
-fno-verify implies ``-fverify-contracts`` (unless -fno-verify-contracts
is given), so a lone -fno-verify is a fast light check: it validates C++ and
contract syntax and contract semantics, but not your logic — handy for editors,
CI pre-flight, and LLM/agent loops.
Other flags¶
cpp-verify --backend={z3,bmc,lean}— verification engine (see Chapter 17 — Backends, modular calls, and debugging)cpp-verify --check-ub— addvalid(p, n)buffer-bounds checks to always-on core definedness (see Chapter 18 — Undefined behavior)cpp-verify --unroll=N— loop bound for BMCcpp-verify --timeout=N— per-query Z3 timeout in ms (default 30000)cpp-verify --diagnostics-format=json— emit versionedcppverify.diagnostic/1JSON Lines for verification resultscpp-verify --lean-project=DIR— generate a preserved, pinned Lean projectcpp-verify --lean-fallback=DIR— export only unresolved Z3 functions to Leancpp-verify --lean-certify— kernel-check all active project proofs without admissions or undocumented proof axiomscpp-verify --dump-ir[=1,2,3,4]— dump VCR / passive / Obligation IR / Z3 layerscpp-verify --lower-only— construct and encode VCs without invoking Z3’s satisfiability checkcpp-verify --obligation-out=FILE— write validated, versioned canonical obligation records with semantic hashescpp-verify --obligation-in=FILE— validate and replay records through Z3, lower-only dumps, or Lean scratch export without reparsing C++; records made by BMC retain and enforce their archived unroll bound
IR layers¶
VCR (control-flow IR)
Passive (SSA assume/assert)
Canonical Obligation IR (typed complete and ordered queries)
Z3 (SMT string)
Multiple layers are separated by ====== in the dump.
Use --lower-only with the dump flags when testing a lowering rule. The
frontend, VCR transforms, passive SSA, canonical obligation construction, and
Z3 encoding all run, including spec-axiom encoding, but Solver.check() does
not. Lowered therefore means “well-formed through backend encoding,” not
“proved.” This is stronger than clang++ -fno-verify, which stops before the
verification IR pipeline.
Compiler flags table and IR dump details: Commands and flags.
Engine API: C++ API reference.