[PATCH] D107339: [analyzer] Retrieve a character from StringLiteral as an initializer for constant arrays.
Denys Petrov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 21 08:49:42 PDT 2021
ASDenysPetrov added a comment.
In D107339#3075306 <https://reviews.llvm.org/D107339#3075306>, @steakhal wrote:
> Why does `glob_invalid_index7()` and `glob_invalid_index8()` differ in behavior?
> I would expect that the analyzer produces the same `Loc` symbolic value for both cases thus, the array access should result in the same behavior regardless if `glob_arr6` is used, or acquired a pointer and using that in a subsequent operation.
> Could you elaborate on this?
You're right about //the same Loc//. There were just limitations of the previous implementation. I've fixed it.
================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1642
+ //
+ // Previous check for `Idx < 0` guarantee that `Idx` is non-negative.
+ const auto I = static_cast<size_t>(Idx.getExtValue());
----------------
steakhal wrote:
> Instead of this comment, you can put an `assert(Idx.isStrictlyPositive())` here.
I reworked this case and we don't need it anymore.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107339/new/
https://reviews.llvm.org/D107339
More information about the cfe-commits
mailing list