ASDenysPetrov added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Core/RegionStore.cpp:1696-1697
+              const auto I = static_cast<uint64_t>(Idx.getExtValue());
+              // Use `getZExtValue` because array extent can not be negative.
+              const uint64_t Extent = CAT->getSize().getZExtValue();
+              // Check for `Idx < 0`, NOT for `I < 0`, because `Idx` CAN be
----------------
martong wrote:
> Do you think it would make sense to `assert(CAT->getSize().isSigned())`?
`getSize` return `APInt` which is //signless// and has no `isSigned` method. 
But we know that an array extent shall be of type `std​::​size_­t` 
(http://eel.is/c++draft/dcl.array#1) which is //unsigned// 
(http://eel.is/c++draft/support.types.layout#3). So we can confidently get the 
size with `getZExtValue`.


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

https://reviews.llvm.org/D104285

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to