Issue |
153764
|
Summary |
[analyzer] False positive for clang-analyzer-security.ArrayBound
|
Labels |
clang:static analyzer,
false-positive
|
Assignees |
|
Reporter |
carlosgalvezp
|
Example:
```cpp
#include <algorithm>
#include <iterator>
#include <string>
int main()
{
std::string input[] = {
"BBC",
"ABC",
"AbC",
"aBC",
"AB",
"ABd",
"abc",
"ABCx",
};
std::sort(std::begin(input), std::end(input));
}
```
Error:
```
opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0/bits/predefined_ops.h:98:24: warning: Out of bound access to memory preceding 'input' [clang-analyzer-security.ArrayBound]
98 | { return __val < *__it; }
| ^
<source>:18:5: note: Calling 'sort<std::basic_string<char> *>'
18 | std::sort(std::begin(input), std::end(input));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Godbolt: https://godbolt.org/z/36sa4W6nK
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs