<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/86969>86969</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[analyzer] Many duplicated ArrayBoundV2 reports
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:static analyzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
steakhal
</td>
</tr>
</table>
<pre>
Recently I had a look at the diff what a clang-18 upgrade would bring, and it turns out we have some inflation in terms of ArrayBoundV2 bug reports.
When I looked at the cases, I started wondering how useful the new "duplicates" are, and I think they are not too relevant.
Here is an example to illustrate the case:
```c++
[[noreturn]] void myabort();
int rng();
int getIndex() {
switch (rng()) {
case 1: return -152;
case 2: return -160;
case 3: return -168;
default: myabort();
}
}
void top(char *p, int n) {
char arr[100];
p = arr;
while (rng()) {
p[getIndex()] = 10; // 3 warnings: Out of bound access to memory preceding 'arr'
}
}
```
I've seen the pattern multiple times, that we have an expression for which we raise the same exact issue, but with a different index in the note. I'd argue that fixing one of these would fix the rest too, thus raising this multiple times for different indexes is questionable.
This isn't an issue that I see frequently, but I think the "uniqueing location" is for solving this/similar situations.
@NagyDonat Have you seen patterns like this? Do you agree that we should unique these reports?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VUGP8jYQ_TXmMlqUOEDCgQMUoY9DW6mq2rOTTBJ3HTtrj5elv74aB9hlW1VC2ZU9Hr_3Zt5YhaB7i7gT64NYHxcq0uD8LhCq10GZRe3a6-43bNCSucIZBtWCAuPcKygCGhBa3XVwGRSBgsYo27_kFcSp96pFuLhoWqi9tr2QP4GyLWgCit4GcJHggjCod4TgRgRtO6NIOwvaAqEfA7gO9t6r68FF2_4hoY49eJycp7AU2VFk-_kLfw5o4ZyAYXuH1qiAge89QyDlCVu4ONsiw4HBXSAG7KJJsRYvIKRs42R0o4jPSVAe77DPQIO2rxx75XWwjoCcA48G35WlG54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