[PATCH] D107339: [analyzer] Retrieve a character from StringLiteral as an initializer for constant arrays.
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 27 06:27:59 PDT 2021
martong added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1757-1760
+ // FIXME: Nevertheless, we can't do the same for cases, like:
+ // const char *str = "123"; // literal length is 4
+ // char c = str[41]; // offset is 41
+ // It should be properly handled before reaching this point.
----------------
ASDenysPetrov wrote:
> ASDenysPetrov wrote:
> > martong wrote:
> > > Thanks for updating the patch! However, this `FIXME` makes me worried. Do you think you could pass the `Decl` itself to `getSValFromInitListExpr` in order to be able to check whether the type is a pointer or an array?
> > This worried me as well. Currently I can't find a way to get the `Decl` for `SL`.
> >
> We can load this as is for now with mentioning the known issue.
This might cause some itchy false positives. Perhaps, we could address this in a follow-up patch and then commit them together?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107339/new/
https://reviews.llvm.org/D107339
More information about the cfe-commits
mailing list