Policy and Environment Options
Every assumption the analyzer can be told to make or drop is a named option below, with its value under each preset. This list is the complete record of what the default preset relaxes. See Configuration for how to set them.
The default preset is
policy = defaultwith ahostedenvironment, the ISO C + POSIX library model, and POSIX assumed with no edition declared.The strict preset is
policy = strictwith ahostedenvironment and the ISO C library model. POSIX contracts and exemptions apply only where POSIX is declared (posix_version).The pedantic preset is
policy = pedanticwith ahostedenvironment and only the library model a project declares (libc); with none declared, no library contract below holds. It reads a rule beyond its text where that rule has a pedantic reading, and may decline a rule outright.
Policy options
assert_is_guardA dominating assert whose condition establishes the property is a guard, even if NDEBUG can strip it.
Default preset:
true; strict preset:false; pedantic preset:falseScope: cross-cutting
Oracle tag:
assert-dominatedBasis: The Clang Static Analyzer, Polyspace and Coverity’s models treat a live assert as an assumption; CERT’s EXP34-C compliant solution uses one.
first_site_onlyIn a proof chain, only the first failing site is reported, not the sites that depend on the same missing check.
Default preset:
true; strict preset:false; pedantic preset:falseScope: cross-cutting
Oracle tag:
dependent-siteBasis: Mainstream path-sensitive analyzers report one missing check once.
trust_noreturn_keywordA function declared _Noreturn (or <stdnoreturn.h> noreturn, or C23 [[noreturn]]) is trusted not to return; otherwise only a body verified never to return proves it.
Default preset:
true; strict preset:true; pedantic preset:falseScope: cross-cutting
Oracle tag:
noreturn-trustedBasis: C11 6.7.4p8, 7.23; C23 6.7.13.7. CERT MSC37-C-EX2 exempts a path that calls a function marked _Noreturn. A GNU noreturn attribute, [[gnu::noreturn]] included, is not proof under this option; only MSC37-C credits it, through its own option msc37_attribute_noreturn.
pre31_unknown_call_purePRE31-C: an unproven call, in an argument an unsafe macro may evaluate other than once, is not treated as a side effect: a call to a function with no definition in the scanned files and no library contract, a call through a pointer, strerror, inet_ntoa, strsignal, gai_strerror, getenv, gmtime and asctime (whose only effect is the static buffer they return), or a call to a scanned function that reaches one of these and nothing shown to have a side effect. A callee shown to have a side effect, in whichever scanned file it is defined, is reported either way.
Default preset:
true; strict preset:false; pedantic preset:falseScope: PRE31-C
Oracle tag:
call-side-effect-unprovenBasis: C11 5.1.2.3p2 (which CERT quotes) makes a call a side effect only when the function does one. cppcheck’s assertWithSideEffect and Polyspace’s MISRA C:2012 Rule 13.5 flag only callees they can show are impure. clang-tidy’s bugprone-assert-side-effect ignores calls by default. PC-lint and Parasoft’s CERT_C-PRE31-c count every call, as the strict policy does.
pre31_listed_library_calls_purePRE31-C: a call to an ISO C or POSIX function the stdlib_call_effects contract lists as free of side effects (strlen, memcmp, isdigit, fabs, ntohs, …) is not a side effect. Off, such a call is an unproven one, like a call to a function the scan has no body for.
Default preset:
true; strict preset:false; pedantic preset:falseScope: PRE31-C
Oracle tag:
library-call-errno-unprovenBasis: Those functions modify no object (C11 7.24 and 7.4), and analyzers that exempt calls they can show are pure treat them so. CERT PRE31-C-EX1 counts “even changing errno” as a side effect, and C11 7.5p3 lets any library function set errno unless its description says otherwise, so the strict policy does not credit them.
env33_locally_constructed_command_allowedENV33-C: a call to system(), popen() or an equivalent is not reported when the command is not a string literal and no untrusted input can reach it: the calling function reads none (no recv, fgets, getenv, read and the like) and either takes no pointer or array parameter, or is static with its address never taken and every caller, up to ones taking no parameters, reads none and returns no tainted value (closed_program does not widen this: ADR-0011). Off, every call is reported as CERT’s page is written. system(NULL) (CERT EX1) is not reported under either value.
Default preset:
true; strict preset:false; pedantic preset:falseScope: ENV33-C
Oracle tag:
command-untaintedBasis: Taint-tracking command-injection checkers report a command only when untrusted data reaches it: CodeQL’s cpp/command-line-injection. clang-tidy’s cert-env33-c reports every call except system(NULL), as the strict policy does (ADR-0001).
env33_exec_spawn_exemptENV33-C: a call to a Windows _exec* or _spawn* function is not reported: it runs a program directly, not through a command processor. Off, each is reported like system().
Default preset:
true; strict preset:true; pedantic preset:falseScope: ENV33-C
Oracle tag:
exec-spawn-not-command-processorBasis: CERT ENV33-C: “Do not invoke a command processor via system() or equivalent functions”; its compliant solutions call execve() and CreateProcess(), which run a program the same way _exec* and _spawn* do.
fio21_tmpfile_exempt_under_posixFIO21-C: a call to tmpfile() is not reported where POSIX holds (posix_version, or the default preset’s assumption): POSIX removes the file it creates when the stream is closed or the process ends. Off, every call is reported as CERT’s page is written. tmpnam(), tempnam() and mktemp() are reported under either value.
Default preset:
true; strict preset:false; pedantic preset:falseScope: FIO21-C
Oracle tag:
tmpfile-removed-under-posixBasis: FIO21-C/2026-10-07/presets: a listed contributor noted on CERT’s page that POSIX guarantees the file’s removal (Gwyn, 2008). CERT’s own table marks tmpfile’s removal as guaranteed except on abnormal termination, and still lists it as noncompliant, as the strict policy does (ADR-0001).
pos34_main_frame_exemptPOS34-C: putenv() of an automatic object in main’s own frame is not reported: main’s automatic objects live until the program ends, so the environment entry does not dangle unless main is called recursively. Off, it is reported as CERT’s rule is written.
Default preset:
true; strict preset:false; pedantic preset:falseScope: POS34-C
Oracle tag:
putenv-main-frameBasis: The Clang Static Analyzer’s security.PutenvStackArray skips main. CERT POS34-C states the rule for any function and gives no exemption; C23 6.2.4p2 ends an automatic object’s lifetime when its block ends, and main’s block ends when main returns.
pos34_exit_path_exemptPOS34-C: putenv() of an automatic object is not reported when every path after the call ends in exit(), _exit(), _Exit(), quick_exit() or abort(), so the entry is never live in a returning function. An exec* call counts only where an exit follows it on every path (execv(…); _exit(127);), because exec returns when it fails. Off, it is reported as CERT’s rule is written.
Default preset:
true; strict preset:false; pedantic preset:falseScope: POS34-C
Oracle tag:
putenv-exit-pathBasis: Clang’s security.PutenvStackArray documents the exit and exec path as a known false positive. CERT POS34-C gives no such exemption.
msc37_attribute_noreturnMSC37-C: a call to a function declared noreturn by a GNU attribute (__attribute__((noreturn)), [[gnu::noreturn]], or a macro defined as one) ends a path the way a return does, as does a function-like macro whose every definition is such a call. The declaration must be in a file the scan reads or a header the prescan reads. The ISO spellings (_Noreturn, [[noreturn]]), written directly or through a macro, are credited by trust_noreturn_keyword, not by this option. Off, only they and verified bodies do, as everywhere else.
Default preset:
true; strict preset:false; pedantic preset:falseScope: MSC37-C
Oracle tag:
noreturn-attributeBasis: CERT MSC37-C-EX2 exempts a path that calls a function marked _Noreturn; GCC and Clang give the GNU attribute the same meaning, and kernels and runtimes use it where C11 is unavailable. It is a promise the compiler does not check, so no stricter policy accepts it.
flp00_exact_zero_comparison_exemptFLP00-C: a floating-point == or != with an exact zero as one operand (0.0, 0.0f, -0.0, 0, the null character, a cast of one to an arithmetic type, or an object-like macro that is one in every build that reaches the comparison) is not reported: zero is exactly representable, and a test against it is a common, legitimate idiom. Off, it is reported like any other floating-point comparison.
Default preset:
true; strict preset:false; pedantic preset:falseScope: FLP00-C
Oracle tag:
exact-zero-comparisonBasis: FLP00-C/2026-10-07/zero: Polyspace exempts a comparison with zero unless asked not to, as does PVS-Studio, and CERT’s own compliant code tests a float against 0.0f.
flp36_constant_assert_is_guardFLP36-C: an assert whose condition compares constants the file can see, among them a standard integer limit or floating-point precision (LONG_MAX, DBL_MANT_DIG and the like), checks the platform, so it counts as a precision check even though NDEBUG can strip it.
Default preset:
true; strict preset:true; pedantic preset:falseScope: FLP36-C
Oracle tag:
platform-constant-assertBasis: In the spirit of CERT FLP36-C’s compliant solution, which asserts the precision of LONG_MAX against the float’s (through popcount() and log2(), so not itself a constant). A comparison of constants has the same value in every build for one target, so a build that strips it is no less safe than the build that checked it.
Environment contracts
closed_programThe scanned files are the whole program: nothing outside them links against it, dlopens it, or loads into it. Then a non-static function’s call sites in the scanned files are all of its call sites, so what every one of them passes proves a fact about its parameter, as it does for a static function: a value range, a buffer size, a non-null pointer, an untainted or range-checked argument. As for a static function, the proof needs at least one call site and no use of the function’s address anywhere in the scanned files, and main stays open. A proof that accepts a caller only because its body reads no untrusted input, whatever value it passes (ENV03-C, ENV33-C and STR02-C), still holds for static functions only, as does the INT30-C to INT32-C test of whether a parameter can receive untrusted or full-range input (the value range every caller passes does count for them). And a non-static, non-const global that no scanned file writes, and a non-static function that only returns a literal, are constants EXP33-C may fold to prune a branch. Undeclared, another translation unit may call the function, write the global or interpose the function, so none of this holds.
Default preset:
false; strict preset:false; pedantic preset:falseScope: contract
Oracle tag:
contract:closed_programBasis: ADR-0011: libraries count as external, and an executable that exports its symbols (-rdynamic, dlopen’ed plugins) is a library too, so in-tree callers and writes prove nothing about a function or global with external linkage; a closed set of call sites, all passing a safe argument, is proof (basis 3). C11 6.2.2p2: every declaration of an identifier with external linkage, in any translation unit, denotes the same object. Declared by the user, never assumed: a Juliet testcase set is a closed program; a library is not.
signal_handlers_persistentA handler installed with signal() stays installed while it runs: the implementation does not reset the signal’s disposition to SIG_DFL before calling it. Then a handler may call signal() on its own signal (SIG34-C EX1). Undeclared, the reset is assumed under every preset, and that call reopens the window in which a second signal takes the default action.
Default preset:
false; strict preset:false; pedantic preset:falseScope: contract
Oracle tag:
contract:signal_handlers_persistentBasis: CERT SIG34-C EX1 (“implementations with persistent signal handlers”) and SIG01-C. C11 7.14.1.1p3: whether the equivalent of signal(sig, SIG_DFL) is executed before a handler is called is implementation-defined, and POSIX.1-2024’s signal() leaves it implementation-defined too, so neither a POSIX environment nor the scanning host establishes it. Declared by the user, never assumed.
free_null_is_noopfree(NULL) does nothing.
Default preset:
true; strict preset:true; pedantic preset:falseScope: contract
Oracle tag:
contract:free_null_is_noopBasis: C11 7.22.3.3p2.
realloc_null_is_mallocrealloc(NULL, size) behaves like malloc(size).
Default preset:
true; strict preset:true; pedantic preset:falseScope: contract
Oracle tag:
contract:realloc_null_is_mallocBasis: C11 7.22.3.5p3.
stdlib_noreturnabort, exit, _Exit, quick_exit, longjmp and thrd_exit never return to their caller, and so does POSIX _exit where POSIX holds (posix_version).
Default preset:
true; strict preset:true; pedantic preset:falseScope: contract
Oracle tag:
contract:stdlib_noreturnBasis: C11 7.22.4.1, 7.22.4.4, 7.22.4.5, 7.22.4.7, 7.13.2.1 and 7.26.5.5; POSIX.1-2024 _exit(). A freestanding implementation need not provide <stdlib.h>, <setjmp.h> or <threads.h> at all. Known limitation: three cross-file summaries built by the prescan (a parameter’s null state after if (!p) exit(1);, whether a function never returns, and what a function leaves in an out-parameter) still credit these calls, _exit included, whatever this option and posix_version say.
stdlib_call_effectsEvery ISO C function, and every POSIX function where POSIX holds (posix_version), the tool knows to have a side effect has one (it sets errno, touches a stream, allocates, or keeps hidden state), and the ones it lists as free of side effects (strlen, memcmp, isdigit, fabs, ntohs, …) modify no object; whether that makes a call pure is the policy’s pre31_listed_library_calls_pure. Withdrawn, a library call is a call to an unknown function.
Default preset:
true; strict preset:true; pedantic preset:falseScope: contract
Oracle tag:
contract:stdlib_call_effectsBasis: C11 7.24 and 7.4: memcmp, strcmp, strncmp, memchr, strchr, strcspn, strpbrk, strrchr, strspn, strstr, strlen and the character classification and case mapping functions modify no object; 7.22.1.4p8 and 7.12.1 (strtol and math functions report errors through errno); CERT PRE31-C-EX1: “even changing errno is a side effect”. Known limitation: the cross-file effect summaries of scanned callees still credit a POSIX callee whatever posix_version says.
library_macros_evaluate_onceA C library function the implementation’s headers define as a macro (glibc’s tolower) evaluates each argument exactly once, whatever its replacement list looks like, including when a project macro hands it an argument. “The implementation’s headers” are any defining the name outside the scanned project, so a third-party library on the search path that redefines a standard name is trusted too (a redefinition C11 7.1.3 already makes undefined). Withdrawn, such a macro is judged by its definition like any other.
Default preset:
true; strict preset:true; pedantic preset:falseScope: contract
Oracle tag:
contract:library_macros_evaluate_onceBasis: C11 7.1.4p1: “Any invocation of a library function that is implemented as a macro shall expand to code that evaluates each of its arguments exactly once”. The standard’s own exceptions (the stream argument of getc, putc, getwc and putwc, and assert) stay unsafe.
main_argv_guaranteesmain’s argc is nonnegative, argv[argc] is a null pointer, and argv[0..argc) point to strings.
Default preset:
true; strict preset:true; pedantic preset:trueScope: contract
Oracle tag:
contract:main_argv_guaranteesBasis: C11 5.1.2.2.1p2, which binds hosted environments only.
static_zero_initObjects with static storage duration and no initializer are zeroed before main runs.
Default preset:
true; strict preset:true; pedantic preset:trueScope: contract
Oracle tag:
contract:static_zero_initBasis: C11 6.7.9p10. Startup code that skips clearing .bss breaks it. Withdrawn, a block-scope static read before its function writes it is indeterminate; file-scope objects, which any function may write first, are not tracked.
Toolchain
include_namesHow an
#includename is matched against the files on disk:exact, orcase-insensitiveas cl does on Windows, where an exact-case entry still wins. It is a fact about the toolchain rather than an assumption the rules trust, so neither preset sets it and it carries no oracle tag. Unset, it iscase-insensitivewhen--compile-commandsnames a cl or clang-cl build andexactotherwise; the scanning host’s own file system never decides it.Set with
[environment] include_namesor--include-namesPart of the settings hash only when
case-insensitiveBasis: Windows looks file names up case-insensitively unless a directory is marked case-sensitive (Microsoft Learn, “Case sensitivity”).
data_modelHow wide the integer types are:
isocredits only what ISO C guarantees (CHAR_BITat least 8,shortandintat least 16 bits,longat least 32,long longat least 64, and the exact width ofint32_tand its kind);ilp32,lp64orllp64declares the target’s model, soINT_MAX,sizeof(long)and the like have their values there. Underisoa limit such asINT_MAXis unknown, a value is proven to fit a type only within the guaranteed range, and a defect that occurs on some conforming width is reported. Undeclared, the default preset assumeslp64on a hosted target; strict and pedantic takeiso, and pedantic says it is missing. Declaring a single integer fact (--set int_bits=16) does not declare a data model: under the default preset the fact overrides one key of the assumedlp64bundle and the model’s source still readsassumed by the preset, and under pedantic the other widths stay at ISO C’s minimums and the scan still warns that no data model is declared.Set with
[environment] data_modelor--data-modelPart of the settings hash when not
iso, withpresetas its source when the preset assumed it. So an assumedlp64and a declared one have different settings hashes although they credit the same widths and give the same findings: the hash records who chose the modelBasis: C11 5.2.4.2.1 (minimum magnitudes), 6.3.1.1 (rank order) and 7.20.1.1 (exact-width types); integer widths are otherwise implementation-defined.
libc,libc_version,c_standardandposix_versionThe C library the target links, its version, and the editions of ISO C and POSIX the code is written for. Like the data model they describe the target, so a
--profilekeeps them.libcselects which library contracts above hold (customtrusts none until an override states it); the other three grant nothing and are recorded for rules whose reading depends on an edition. None is inferred from the machine running the scan, each is unknown unless declared, and each enters the settings hash only when declared.c_standard,posix_versionand the data model are facts of the project’s own declaration: the configuration, or a compile database passed with--compile-commands(-std=,-D_POSIX_C_SOURCE=,-D_XOPEN_SOURCE=,-m32and-m64). A compile database’s facts are recorded per translation unit, but the rules read one project-wide answer (see Configuration); the configuration holds for the whole project and wins a disagreement, which the scan reports. Each declared fact’s source (cli,configorcompile database) is part of the settings hash. When a fact is unknown, nothing that depends on it is credited: no exemption that rests on it applies, and no finding only it gives grounds for is reported. The default preset is the exception: it assumes POSIX with no edition. Understrictandpedanticthe scan names the missingposix_versionand the enabled rules whose reading waits on it (--check-configwarns the same way).Set with
[environment]keys,--libc, or--set c_standard=c99(alsoposix_version,libc_version), or with a compile databasenewlib-nano: newlib with nano-malloc, whosefree(NULL)returns at once and whoserealloc(NULL, n)callsmalloc(newlib’snano-mallocr.c)
Declared memory functions
allocatorsanddeallocatorsA function the scan has no body for (a platform hook supplied at build time, or a library outside the scanned tree) cannot be proven to allocate or to free. A project declares what such a function does: a deallocator frees the argument its position names (counting from 1), and an allocator returns fresh memory under the contract of the standard allocator it names (
malloc,calloc,realloc,aligned_alloc,strduporstrndup). Arealloc-like allocator also releases the block its first argument points at. The memory-lifetime rules (MEM00-C, MEM01-C, MEM03-C, MEM30-C, MEM31-C, MEM34-C) and the function summaries that credit a wrapper with what it frees read the declarations, whichever way they cut: a free through a declared hook excuses a leak and makes a second free a double free. A rule that only asks whether a call allocates at all counts a declared allocator too. Null-state, unchecked-result and allocation-size checks still recognize the standard names only. A function whose body the scan reads needs no declaration, and a C library function cannot be declared, since its contract is the library’s.Set with
[environment.allocators]NAME = "CONTRACT"and[environment.deallocators]NAME = ARG, or--allocator NAME[=CONTRACT](defaultmalloc) and--deallocator NAME[=ARG](default 1)Part of the settings hash only when something is declared
Basis: the project’s own statement of its environment (ADR-0001, ADR-0015)
Declared thread-API families
threadsThe concurrency rules read a hazard, not one API’s spelling: CON30-C and CON36-C ask which thread operation a call performs (create, lock, wait, store thread-specific data, …). C11
<threads.h>is always read. POSIX threads are read unlessposix_version = "none"orposix = "off"says the target is not POSIX. A call counts when its callee resolves to the function, not to an object of the same name. An RTOS’s API is read only when declared:familiesselects a shipped profile (freertos, checked against FreeRTOS-Kernel V11.2.0), andfunctionsgives the project’s own, each as{ op = "KIND", ROLE = N }with 1-based argument positions. A C11 or POSIX function cannot be declared, since its contract is the library’s.Set with
[environment.threads](families,posix) and[environment.threads.functions]/[environment.threads.types]Part of the settings hash only when something differs from the default
Basis:
docs/design/thread-api-families.md(ADR-0006, ADR-0015)