Further improve value tracking to catch more out-of-bounds errors
This one is straight from the discussion forum (http://www.gimpel.com/Discussion.cfm?ThreadID=5087) and not yet detected in PC-LINT Plus Beta 8c (i assumed because of the additional level of indirection):
void main(void)
{
int array[4];
int index = 0;
for (int loop = 0; loop < 10; ++loop)
{
array[index] = loop;
++index;
array[index] = loop;
++index;
}
array[0] = array[1];
}
2
votes
AStares
shared this idea