Options That Control Static Analysis#
- -fanalyzer#
This option enables an static analysis of program flow which looks for ‘interesting’ interprocedural paths through the code, and issues warnings for problems found on them.
This analysis is much more expensive than other GCC warnings.
Enabling this option effectively enables the following warnings:
-Wanalyzer-allocation-size-Wanalyzer-double-fclose-Wanalyzer-double-free-Wanalyzer-exposure-through-output-file-Wanalyzer-exposure-through-uninit-copy-Wanalyzer-fd-access-mode-mismatch-Wanalyzer-fd-double-close-Wanalyzer-fd-leak-Wanalyzer-fd-use-after-close-Wanalyzer-fd-use-without-check-Wanalyzer-file-leak-Wanalyzer-free-of-non-heap-Wanalyzer-imprecise-fp-arithmetic-Wanalyzer-jump-through-null-Wanalyzer-malloc-leak-Wanalyzer-mismatching-deallocation-Wanalyzer-null-argument-Wanalyzer-null-dereference-Wanalyzer-out-of-bounds-Wanalyzer-possible-null-argument-Wanalyzer-possible-null-dereference-Wanalyzer-putenv-of-auto-var-Wanalyzer-shift-count-negative-Wanalyzer-shift-count-overflow-Wanalyzer-stale-setjmp-buffer-Wanalyzer-unsafe-call-within-signal-handler-Wanalyzer-use-after-free-Wanalyzer-use-of-pointer-in-stale-stack-frame-Wanalyzer-use-of-uninitialized-value-Wanalyzer-va-arg-type-mismatch-Wanalyzer-va-list-exhausted-Wanalyzer-va-list-leak-Wanalyzer-va-list-use-after-va-end-Wanalyzer-write-to-const-Wanalyzer-write-to-string-literal
- -fno-analyzer#
Default setting; overrides
-fanalyzer.
- -Wanalyzer-too-complex#
If
-fanalyzeris enabled, the analyzer uses various heuristics to attempt to explore the control flow and data flow in the program, but these can be defeated by sufficiently complicated code.By default, the analysis silently stops if the code is too complicated for the analyzer to fully explore and it reaches an internal limit. The
-Wanalyzer-too-complexoption warns if this occurs.
- -Wno-analyzer-too-complex#
Default setting; overrides
-Wanalyzer-too-complex.
- -Wno-analyzer-allocation-size#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-allocation-sizeto disable it.This diagnostic warns for paths through the code in which a pointer to a buffer is assigned to point at a buffer with a size that is not a multiple of
sizeof (*pointer).
- -Wanalyzer-allocation-size#
Default setting; overrides
-Wno-analyzer-allocation-size.
- -Wno-analyzer-double-fclose#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-double-fcloseto disable it.This diagnostic warns for paths through the code in which a
FILE *can havefclosecalled on it more than once.
- -Wanalyzer-double-fclose#
Default setting; overrides
-Wno-analyzer-double-fclose.
- -Wno-analyzer-double-free#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-double-freeto disable it.This diagnostic warns for paths through the code in which a pointer can have a deallocator called on it more than once, either
free, or a deallocator referenced by attributemalloc.See CWE-415: Double Free.
- -Wanalyzer-double-free#
Default setting; overrides
-Wno-analyzer-double-free.
- -Wno-analyzer-exposure-through-output-file#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-exposure-through-output-fileto disable it.This diagnostic warns for paths through the code in which a security-sensitive value is written to an output file (such as writing a password to a log file).
- -Wanalyzer-exposure-through-output-file#
Default setting; overrides
-Wno-analyzer-exposure-through-output-file.
- -Wanalyzer-exposure-through-uninit-copy#
This warning requires both
-fanalyzerand the use of a plugin to specify a function that copies across a ‘trust boundary’. Use-Wno-analyzer-exposure-through-uninit-copyto disable it.This diagnostic warns for ‘infoleaks’ - paths through the code in which uninitialized values are copied across a security boundary (such as code within an OS kernel that copies a partially-initialized struct on the stack to user space).
See CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
- -Wno-analyzer-exposure-through-uninit-copy#
Default setting; overrides
-Wanalyzer-exposure-through-uninit-copy.
- -Wno-analyzer-fd-access-mode-mismatch#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-fd-access-mode-mismatchto disable it.This diagnostic warns for paths through code in which a
readon a write-only file descriptor is attempted, or vice versa.This diagnostic also warns for code paths in a which a function with attribute
fd_arg_read (N)is called with a file descriptor opened withO_WRONLYat referenced argumentNor a function with attributefd_arg_write (N)is called with a file descriptor opened withO_RDONLYat referenced argumentN.
- -Wanalyzer-fd-access-mode-mismatch#
Default setting; overrides
-Wno-analyzer-fd-access-mode-mismatch.
- -Wno-analyzer-fd-double-close#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-fd-double-closeto disable it.This diagnostic warns for paths through code in which a file descriptor can be closed more than once.
- -Wanalyzer-fd-double-close#
Default setting; overrides
-Wno-analyzer-fd-double-close.
- -Wno-analyzer-fd-leak#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-fd-leakto disable it.This diagnostic warns for paths through code in which an open file descriptor is leaked.
See CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime.
- -Wanalyzer-fd-leak#
Default setting; overrides
-Wno-analyzer-fd-leak.
- -Wno-analyzer-fd-use-after-close#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-fd-use-after-closeto disable it.This diagnostic warns for paths through code in which a read or write is called on a closed file descriptor.
This diagnostic also warns for paths through code in which a function with attribute
fd_arg (N)orfd_arg_read (N)orfd_arg_write (N)is called with a closed file descriptor at referenced argumentN.
- -Wanalyzer-fd-use-after-close#
Default setting; overrides
-Wno-analyzer-fd-use-after-close.
- -Wno-analyzer-fd-use-without-check#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-fd-use-without-checkto disable it.This diagnostic warns for paths through code in which a file descriptor is used without being checked for validity.
This diagnostic also warns for paths through code in which a function with attribute
fd_arg (N)orfd_arg_read (N)orfd_arg_write (N)is called with a file descriptor, at referenced argumentN, without being checked for validity.
- -Wanalyzer-fd-use-without-check#
Default setting; overrides
-Wno-analyzer-fd-use-without-check.
- -Wno-analyzer-file-leak#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-file-leakto disable it.This diagnostic warns for paths through the code in which a
<stdio.h>FILE *stream object is leaked.See CWE-775: Missing Release of File Descriptor or Handle after Effective Lifetime.
- -Wanalyzer-file-leak#
Default setting; overrides
-Wno-analyzer-file-leak.
- -Wno-analyzer-free-of-non-heap#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-free-of-non-heapto disable it.This diagnostic warns for paths through the code in which
freeis called on a non-heap pointer (e.g. an on-stack buffer, or a global).
- -Wanalyzer-free-of-non-heap#
Default setting; overrides
-Wno-analyzer-free-of-non-heap.
- -Wno-analyzer-imprecise-fp-arithmetic#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-imprecise-fp-arithmeticto disable it.This diagnostic warns for paths through the code in which floating-point arithmetic is used in locations where precise computation is needed. This diagnostic only warns on use of floating-point operands inside the calculation of an allocation size at the moment.
- -Wanalyzer-imprecise-fp-arithmetic#
Default setting; overrides
-Wno-analyzer-imprecise-fp-arithmetic.
- -Wno-analyzer-jump-through-null#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-jump-through-nullto disable it.This diagnostic warns for paths through the code in which a
NULLfunction pointer is called.
- -Wanalyzer-jump-through-null#
Default setting; overrides
-Wno-analyzer-jump-through-null.
- -Wno-analyzer-malloc-leak#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-malloc-leakto disable it.This diagnostic warns for paths through the code in which a pointer allocated via an allocator is leaked: either
malloc, or a function marked with attributemalloc.See CWE-401: Missing Release of Memory after Effective Lifetime.
- -Wanalyzer-malloc-leak#
Default setting; overrides
-Wno-analyzer-malloc-leak.
- -Wno-analyzer-mismatching-deallocation#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-mismatching-deallocationto disable it.This diagnostic warns for paths through the code in which the wrong deallocation function is called on a pointer value, based on which function was used to allocate the pointer value. The diagnostic will warn about mismatches between
free, scalardeleteand vectordelete[], and those marked as allocator/deallocator pairs using attributemalloc.
- -Wanalyzer-mismatching-deallocation#
Default setting; overrides
-Wno-analyzer-mismatching-deallocation.
- -Wno-analyzer-out-of-bounds#
This warning requires
-fanalyzerto enable it; use-Wno-analyzer-out-of-boundsto disable it.This diagnostic warns for path through the code in which a buffer is definitely read or written out-of-bounds. The diagnostic applies for cases where the analyzer is able to determine a constant offset and for accesses past the end of a buffer, also a constant capacity. Further, the diagnostic does limited checking for accesses past the end when the offset as well as the capacity is symbolic.
See CWE-119: Improper Restriction of Operations within the Bounds of a Memory Buffer.
- -Wanalyzer-out-of-bounds#
Default setting; overrides
-Wno-analyzer-out-of-bounds.
- -Wno-analyzer-possible-null-argument#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-possible-null-argumentto disable it.This diagnostic warns for paths through the code in which a possibly-NULL value is passed to a function argument marked with
__attribute__((nonnull))as requiring a non-NULL value.See CWE-690: Unchecked Return Value to NULL Pointer Dereference.
- -Wanalyzer-possible-null-argument#
Default setting; overrides
-Wno-analyzer-possible-null-argument.
- -Wno-analyzer-possible-null-dereference#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-possible-null-dereferenceto disable it.This diagnostic warns for paths through the code in which a possibly-NULL value is dereferenced.
See CWE-690: Unchecked Return Value to NULL Pointer Dereference.
- -Wanalyzer-possible-null-dereference#
Default setting; overrides
-Wno-analyzer-possible-null-dereference.
- -Wno-analyzer-null-argument#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-null-argumentto disable it.This diagnostic warns for paths through the code in which a value known to be NULL is passed to a function argument marked with
__attribute__((nonnull))as requiring a non-NULL value.
- -Wanalyzer-null-argument#
Default setting; overrides
-Wno-analyzer-null-argument.
- -Wno-analyzer-null-dereference#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-null-dereferenceto disable it.This diagnostic warns for paths through the code in which a value known to be NULL is dereferenced.
- -Wanalyzer-null-dereference#
Default setting; overrides
-Wno-analyzer-null-dereference.
- -Wno-analyzer-putenv-of-auto-var#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-putenv-of-auto-varto disable it.This diagnostic warns for paths through the code in which a call to
putenvis passed a pointer to an automatic variable or an on-stack buffer.See POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument.
- -Wanalyzer-putenv-of-auto-var#
Default setting; overrides
-Wno-analyzer-putenv-of-auto-var.
- -Wno-analyzer-shift-count-negative#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-shift-count-negativeto disable it.This diagnostic warns for paths through the code in which a shift is attempted with a negative count. It is analogous to the
-Wshift-count-negativediagnostic implemented in the C/C++ front ends, but is implemented based on analyzing interprocedural paths, rather than merely parsing the syntax tree. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings.
- -Wanalyzer-shift-count-negative#
Default setting; overrides
-Wno-analyzer-shift-count-negative.
- -Wno-analyzer-shift-count-overflow#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-shift-count-overflowto disable it.This diagnostic warns for paths through the code in which a shift is attempted with a count greater than or equal to the precision of the operand’s type. It is analogous to the
-Wshift-count-overflowdiagnostic implemented in the C/C++ front ends, but is implemented based on analyzing interprocedural paths, rather than merely parsing the syntax tree. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings.
- -Wanalyzer-shift-count-overflow#
Default setting; overrides
-Wno-analyzer-shift-count-overflow.
- -Wno-analyzer-stale-setjmp-buffer#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-stale-setjmp-bufferto disable it.This diagnostic warns for paths through the code in which
longjmpis called to rewind to ajmp_bufrelating to asetjmpcall in a function that has returned.When
setjmpis called on ajmp_bufto record a rewind location, it records the stack frame. The stack frame becomes invalid when the function containing thesetjmpcall returns. Attempting to rewind to it vialongjmpwould reference a stack frame that no longer exists, and likely lead to a crash (or worse).
- -Wanalyzer-stale-setjmp-buffer#
Default setting; overrides
-Wno-analyzer-stale-setjmp-buffer.
- -Wno-analyzer-tainted-allocation-size#
This warning requires both
-fanalyzerand-fanalyzer-checker=taintto enable it; use-Wno-analyzer-tainted-allocation-sizeto disable it.This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the size of an allocation without being sanitized, so that an attacker could inject an excessively large allocation and potentially cause a denial of service attack.
- -Wanalyzer-tainted-allocation-size#
Default setting; overrides
-Wno-analyzer-tainted-allocation-size.
- -Wno-analyzer-tainted-array-index#
This warning requires both
-fanalyzerand-fanalyzer-checker=taintto enable it; use-Wno-analyzer-tainted-array-indexto disable it.This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the index of an array access without being sanitized, so that an attacker could inject an out-of-bounds access.
- -Wanalyzer-tainted-array-index#
Default setting; overrides
-Wno-analyzer-tainted-array-index.
- -Wno-analyzer-tainted-divisor#
This warning requires both
-fanalyzerand-fanalyzer-checker=taintto enable it; use-Wno-analyzer-tainted-divisorto disable it.This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the divisor in a division or modulus operation without being sanitized, so that an attacker could inject a division-by-zero.
- -Wanalyzer-tainted-divisor#
Default setting; overrides
-Wno-analyzer-tainted-divisor.
- -Wno-analyzer-tainted-offset#
This warning requires both
-fanalyzerand-fanalyzer-checker=taintto enable it; use-Wno-analyzer-tainted-offsetto disable it.This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as a pointer offset without being sanitized, so that an attacker could inject an out-of-bounds access.
- -Wanalyzer-tainted-offset#
Default setting; overrides
-Wno-analyzer-tainted-offset.
- -Wno-analyzer-tainted-size#
This warning requires both
-fanalyzerand-fanalyzer-checker=taintto enable it; use-Wno-analyzer-tainted-sizeto disable it.This diagnostic warns for paths through the code in which a value that could be under an attacker’s control is used as the size of an operation such as
memsetwithout being sanitized, so that an attacker could inject an out-of-bounds access.
- -Wanalyzer-tainted-size#
Default setting; overrides
-Wno-analyzer-tainted-size.
- -Wno-analyzer-unsafe-call-within-signal-handler#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-unsafe-call-within-signal-handlerto disable it.This diagnostic warns for paths through the code in which a function known to be async-signal-unsafe (such as
fprintf) is called from a signal handler.See CWE-479: Signal Handler Use of a Non-reentrant Function.
- -Wanalyzer-unsafe-call-within-signal-handler#
Default setting; overrides
-Wno-analyzer-unsafe-call-within-signal-handler.
- -Wno-analyzer-use-after-free#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-use-after-freeto disable it.This diagnostic warns for paths through the code in which a pointer is used after a deallocator is called on it: either
free, or a deallocator referenced by attributemalloc.
- -Wanalyzer-use-after-free#
Default setting; overrides
-Wno-analyzer-use-after-free.
- -Wno-analyzer-use-of-pointer-in-stale-stack-frame#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-use-of-pointer-in-stale-stack-frameto disable it.This diagnostic warns for paths through the code in which a pointer is dereferenced that points to a variable in a stale stack frame.
- -Wanalyzer-use-of-pointer-in-stale-stack-frame#
Default setting; overrides
-Wno-analyzer-use-of-pointer-in-stale-stack-frame.
- -Wno-analyzer-va-arg-type-mismatch#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-va-arg-type-mismatchto disable it.This diagnostic warns for interprocedural paths through the code for which the analyzer detects an attempt to use
va_argto extract a value passed to a variadic call, but uses a type that does not match that of the expression passed to the call.
- -Wanalyzer-va-arg-type-mismatch#
Default setting; overrides
-Wno-analyzer-va-arg-type-mismatch.
- -Wno-analyzer-va-list-exhausted#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-va-list-exhaustedto disable it.This diagnostic warns for interprocedural paths through the code for which the analyzer detects an attempt to use
va_argto access the next value passed to a variadic call, but all of the values in theva_listhave already been consumed.See CWE-685: Function Call With Incorrect Number of Arguments.
- -Wanalyzer-va-list-exhausted#
Default setting; overrides
-Wno-analyzer-va-list-exhausted.
- -Wno-analyzer-va-list-leak#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-va-list-leakto disable it.This diagnostic warns for interprocedural paths through the code for which the analyzer detects that
va_startorva_copyhas been called on ava_listwithout a corresponding call tova_end.
- -Wanalyzer-va-list-leak#
Default setting; overrides
-Wno-analyzer-va-list-leak.
- -Wno-analyzer-va-list-use-after-va-end#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-va-list-use-after-va-endto disable it.This diagnostic warns for interprocedural paths through the code for which the analyzer detects an attempt to use a
va_listafterva_endhas been called on it.va_list.
- -Wanalyzer-va-list-use-after-va-end#
Default setting; overrides
-Wno-analyzer-va-list-use-after-va-end.
- -Wno-analyzer-write-to-const#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-write-to-constto disable it.This diagnostic warns for paths through the code in which the analyzer detects an attempt to write through a pointer to a
constobject. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings.
- -Wanalyzer-write-to-const#
Default setting; overrides
-Wno-analyzer-write-to-const.
- -Wno-analyzer-write-to-string-literal#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-write-to-string-literalto disable it.This diagnostic warns for paths through the code in which the analyzer detects an attempt to write through a pointer to a string literal. However, the analyzer does not prioritize detection of such paths, so false negatives are more likely relative to other warnings.
- -Wanalyzer-write-to-string-literal#
Default setting; overrides
-Wno-analyzer-write-to-string-literal.
- -Wno-analyzer-use-of-uninitialized-value#
This warning requires
-fanalyzer, which enables it; use-Wno-analyzer-use-of-uninitialized-valueto disable it.This diagnostic warns for paths through the code in which an uninitialized value is used.
- -Wanalyzer-use-of-uninitialized-value#
Default setting; overrides
-Wno-analyzer-use-of-uninitialized-value.
The analyzer has hardcoded knowledge about the behavior of the following memory-management functions:
allocaThe built-in functions
__builtin_alloc,__builtin_alloc_with_align,__builtin_calloc,__builtin_free,__builtin_malloc,__builtin_memcpy,__builtin_memcpy_chk,__builtin_memset,__builtin_memset_chk,__builtin_realloc,__builtin_stack_restore, and__builtin_stack_savecallocfreemallocmemsetoperator deleteoperator delete []operator newoperator new []reallocstrdupstrndup
of the following functions for working with file descriptors:
openclosecreatdup,dup2anddup3pipeandpipe2readwrite
of the following functions for working with <stdio.h> streams:
The built-in functions
__builtin_fprintf,__builtin_fprintf_unlocked,__builtin_fputc,__builtin_fputc_unlocked,__builtin_fputs,__builtin_fputs_unlocked,__builtin_fwrite,__builtin_fwrite_unlocked,__builtin_printf,__builtin_printf_unlocked,__builtin_putc,__builtin_putchar,__builtin_putchar_unlocked,__builtin_putc_unlocked,__builtin_puts,__builtin_puts_unlocked,__builtin_vfprintf, and__builtin_vprintffopenfclosefgetsfgets_unlockedfreadgetcharfprintfprintffwrite
and of the following functions:
The built-in functions
__builtin_expect,__builtin_expect_with_probability,__builtin_strchr,__builtin_strcpy,__builtin_strcpy_chk,__builtin_strlen,__builtin_va_copy, and__builtin_va_startThe GNU extensions
erroranderror_at_linegetpasslongjmpputenvsetjmpsiglongjmpsignalsigsetjmpstrchrstrlen
In addition, various functions with an __analyzer_ prefix have
special meaning to the analyzer, described in the GCC Internals manual.
Pertinent parameters for controlling the exploration are:
--param analyzer-bb-explosion-factor=value,
--param analyzer-max-enodes-per-program-point=value,
--param analyzer-max-recursion-depth=value and
--param analyzer-min-snodes-for-call-summary=value.
The following options control the analyzer.
- -fanalyzer-call-summaries#
Simplify interprocedural analysis by computing the effect of certain calls, rather than exploring all paths through the function from callsite to each possible return.
If enabled, call summaries are only used for functions with more than one call site, and that are sufficiently complicated (as per
--paramanalyzer-min-snodes-for-call-summary=value).
- -fno-analyzer-call-summaries#
Default setting; overrides
-fanalyzer-call-summaries.
- -fanalyzer-checker=name#
Restrict the analyzer to run just the named checker, and enable it.
Some checkers are disabled by default (even with
-fanalyzer), such as thetaintchecker that implements-Wanalyzer-tainted-array-index, and this option is required to enable them.Note
Currently,
-fanalyzer-checker=taintdisables the following warnings from-fanalyzer:-Wanalyzer-double-fclose-Wanalyzer-double-free-Wanalyzer-exposure-through-output-file-Wanalyzer-fd-access-mode-mismatch-Wanalyzer-fd-double-close-Wanalyzer-fd-leak-Wanalyzer-fd-use-after-close-Wanalyzer-fd-use-without-check-Wanalyzer-file-leak-Wanalyzer-free-of-non-heap-Wanalyzer-malloc-leak-Wanalyzer-mismatching-deallocation-Wanalyzer-null-argument-Wanalyzer-null-dereference-Wanalyzer-possible-null-argument-Wanalyzer-possible-null-dereference-Wanalyzer-unsafe-call-within-signal-handler-Wanalyzer-use-after-free-Wanalyzer-va-list-leak-Wanalyzer-va-list-use-after-va-end
- -fno-analyzer-feasibility#
This option is intended for analyzer developers.
By default the analyzer verifies that there is a feasible control flow path for each diagnostic it emits: that the conditions that hold are not mutually exclusive. Diagnostics for which no feasible path can be found are rejected. This filtering can be suppressed with
-fno-analyzer-feasibility, for debugging issues in this code.
- -fanalyzer-feasibility#
Default setting; overrides
-fno-analyzer-feasibility.
- -fanalyzer-fine-grained#
This option is intended for analyzer developers.
Internally the analyzer builds an ‘exploded graph’ that combines control flow graphs with data flow information.
By default, an edge in this graph can contain the effects of a run of multiple statements within a basic block. With
-fanalyzer-fine-grained, each statement gets its own edge.
- -fno-analyzer-fine-grained#
Default setting; overrides
-fanalyzer-fine-grained.
- -fanalyzer-show-duplicate-count#
This option is intended for analyzer developers: if multiple diagnostics have been detected as being duplicates of each other, it emits a note when reporting the best diagnostic, giving the number of additional diagnostics that were suppressed by the deduplication logic.
- -fno-analyzer-show-duplicate-count#
Default setting; overrides
-fanalyzer-show-duplicate-count.
- -fno-analyzer-state-merge#
This option is intended for analyzer developers.
By default the analyzer attempts to simplify analysis by merging sufficiently similar states at each program point as it builds its ‘exploded graph’. With
-fno-analyzer-state-mergethis merging can be suppressed, for debugging state-handling issues.
- -fanalyzer-state-merge#
Default setting; overrides
-fno-analyzer-state-merge.
- -fno-analyzer-state-purge#
This option is intended for analyzer developers.
By default the analyzer attempts to simplify analysis by purging aspects of state at a program point that appear to no longer be relevant e.g. the values of locals that aren’t accessed later in the function and which aren’t relevant to leak analysis.
With
-fno-analyzer-state-purgethis purging of state can be suppressed, for debugging state-handling issues.
- -fanalyzer-state-purge#
Default setting; overrides
-fno-analyzer-state-purge.
- -fanalyzer-transitivity#
This option enables transitivity of constraints within the analyzer.
- -fno-analyzer-transitivity#
Default setting; overrides
-fanalyzer-transitivity.
- -fno-analyzer-undo-inlining#
This option is intended for analyzer developers.
-fanalyzerruns relatively late compared to other code analysis tools, and some optimizations have already been applied to the code. In particular function inlining may have occurred, leading to the interprocedural execution paths emitted by the analyzer containing function frames that don’t correspond to those in the original source code.By default the analyzer attempts to reconstruct the original function frames, and to emit events showing the inlined calls.
With
-fno-analyzer-undo-inliningthis attempt to reconstruct the original frame information can be be disabled, which may be of help when debugging issues in the analyzer.
- -fanalyzer-undo-inlining#
Default setting; overrides
-fno-analyzer-undo-inlining.
- -fanalyzer-verbose-edges#
This option is intended for analyzer developers. It enables more verbose, lower-level detail in the descriptions of control flow within diagnostic paths.
- -fanalyzer-verbose-state-changes#
This option is intended for analyzer developers. It enables more verbose, lower-level detail in the descriptions of events relating to state machines within diagnostic paths.
- -fanalyzer-verbosity=level#
This option controls the complexity of the control flow paths that are emitted for analyzer diagnostics.
The
levelcan be one of:0At this level, interprocedural call and return events are displayed, along with the most pertinent state-change events relating to a diagnostic. For example, for a double-
freediagnostic, both calls tofreewill be shown.1As per the previous level, but also show events for the entry to each function.
2As per the previous level, but also show events relating to control flow that are significant to triggering the issue (e.g. ‘true path taken’ at a conditional).
This level is the default.
3As per the previous level, but show all control flow events, not just significant ones.
4This level is intended for analyzer developers; it adds various other events intended for debugging the analyzer.
- -fdump-analyzer#
Dump internal details about what the analyzer is doing to
file.analyzer.txt. This option is overridden by-fdump-analyzer-stderr.
- -fdump-analyzer-stderr#
Dump internal details about what the analyzer is doing to stderr. This option overrides
-fdump-analyzer.
- -fdump-analyzer-callgraph#
Dump a representation of the call graph suitable for viewing with GraphViz to
file.callgraph.dot.
- -fdump-analyzer-exploded-graph#
Dump a representation of the ‘exploded graph’ suitable for viewing with GraphViz to
file.eg.dot. Nodes are color-coded based on state-machine states to emphasize state changes.
- -fdump-analyzer-exploded-nodes#
Emit diagnostics showing where nodes in the ‘exploded graph’ are in relation to the program source.
- -fdump-analyzer-exploded-nodes-2#
Dump a textual representation of the ‘exploded graph’ to
file.eg.txt.
- -fdump-analyzer-exploded-nodes-3#
Dump a textual representation of the ‘exploded graph’ to one dump file per node, to
file.eg-id.txt. This is typically a large number of dump files.
- -fdump-analyzer-exploded-paths#
Dump a textual representation of the ‘exploded path’ for each diagnostic to
file.idx.kind.epath.txt.
- -fdump-analyzer-feasibility#
Dump internal details about the analyzer’s search for feasible paths. The details are written in a form suitable for viewing with GraphViz to filenames of the form
file.*.fg.dot,file.*.tg.dot, andfile.*.fpath.txt.
- -fdump-analyzer-json#
Dump a compressed JSON representation of analyzer internals to
file.analyzer.json.gz. The precise format is subject to change.
- -fdump-analyzer-state-purge#
As per
-fdump-analyzer-supergraph, dump a representation of the ‘supergraph’ suitable for viewing with GraphViz, but annotate the graph with information on what state will be purged at each node. The graph is written tofile.state-purge.dot.
- -fdump-analyzer-supergraph#
Dump representations of the ‘supergraph’ suitable for viewing with GraphViz to
file.supergraph.dotand tofile.supergraph-eg.dot. These show all of the control flow graphs in the program, with interprocedural edges for calls and returns. The second dump contains annotations showing nodes in the ‘exploded graph’ and diagnostics associated with them.
- -fdump-analyzer-untracked#
Emit custom warnings with internal details intended for analyzer developers.