V736. The behavior is undefined for arithmetic or comparisons with pointers that do not point to members of the same array.

The behavior is undefined if arithmetic or comparison operations are applied to pointers that point to items belonging to different arrays.

Consider the following example:

int a[10], b[20];
fill(a, b);
if (&a[1] > &b[2])

There is some bug in this code. For example, it could have been affected by bad "find and replace" in some lines. Assume that the '&' operators are unnecessary here. Then the fixed version should look like this:

if (a[1] > b[2])

According to Common Weakness Enumeration, potential errors found by using this diagnostic are classified as CWE-758.

Bugs Found

Checked Projects
Collected Errors
13 926