[PATCH] D107339: [analyzer] Retrieve a character from StringLiteral as an initializer for constant arrays.

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 20 08:28:34 PDT 2021


steakhal added a comment.

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?



================
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());
----------------
Instead of this comment, you can put an `assert(Idx.isStrictlyPositive())` here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107339/new/

https://reviews.llvm.org/D107339



More information about the cfe-commits mailing list