FaultDetection-UnrelatedPointerSubtraction

Avoid pointer subtraction on unrelated pointers

Required inputs: IR, StaticSemanticAnalysis

This check looks for pointer subtraction between pointers not referring to the same object (usually, an array).

Possible Messages

Key

Text

Severity

Disabled

possible_unrelated_ptr_subtraction

Subtracting possibly unrelated pointers

None

False

unrelated_ptr_subtraction

Subtracting unrelated pointers

None

False

Options

check_non_array_pointers

check_non_array_pointers : bool = False

Whether the check should also consider pointers to non-arrays (e.g., comparison of pointers to different fields). If enabled, a pointer to an object that is not an array is treated as if it were a pointer to the first element of an array with a single element.
 

report_empty_points_to_sets

report_empty_points_to_sets : bool = False

Report cases where one of the pointers involved in the comparison does not point to any value. This can occur e.g. if parameters of entry functions are analyzed, for which no values are known.