6.2.12.9. FaultDetection¶
Static checks for possible runtime errors
Nested Rules
Alternate input and output operations shall not be used without an intervening flush or positioning call |
|
Only assign values corresponding to the enumerators to an expression of enumeration type |
|
The arguments to string handling functions from the Standard Library shall not result in accesses beyond the bounds of the objects referenced by their pointer arguments |
|
There shall be no dead branches |
|
There shall be no dead exception handlers |
|
Avoid division by zero |
|
Do not release dynamically allocated memory twice |
|
The address of a local variable should not escape its function |
|
The assignment-expression of a throw statement shall not itself cause an exception to be thrown |
|
Where a function’s declaration includes an exception-specification, the function shall only be capable of throwing exceptions of the indicated type(s) |
|
The same file shall not be open for read and write access at the same time on different streams |
|
When allocated in specific ways, some resource operations are forbidden |
|
Mark functions being (not) analysed by static semantic analysis |
|
Avoid overflow in indirect assignments |
|
Avoid computations or casts resulting in integer overflow |
|
The validity of values passed to library functions shall be checked |
|
Do not forget to free allocated memory |
|
When allocated in specific ways, some resource operations are required before deallocation |
|
If a function is declared with noexcept(true) no exceptions should be thrown as this results in a call to std::terminate() |
|
There shall be no attempt to dereference a null pointer |
|
Array index must be inside array bounds |
|
There shall be no statements that could be removed because they do not contribute to a function’s result |
|
Do not release stack/static objects |
|
The validity of values received from external sources shall be checked |
|
Each exception explicitly thrown in the code shall have a handler of a compatible type in all call paths that could lead to that point |
|
A class destructor shall not exit with an exception |
|
Exceptions shall be raised only after start-up and before termination of the program |
|
Avoid accessing the value of an uninitialized variable |
|
Avoid comparing unrelated pointers |
|
Avoid pointer subtraction on unrelated pointers |
|
A project shall not contain unused assignments |
|
Do not access memory locations after they have been released |
|
Release dynamically allocated memory with appropriate function |
|
Static checks for runtime errors due to parallelism |
Options
Setting an option for this rule means setting the default for all nested rules.
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.