[PATCH] D136603: [analyzer] Model cast after LValueToRValueBitCasts

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 27 03:57:32 PDT 2022


steakhal updated this revision to Diff 471112.
steakhal added a comment.

Previously, even in the `RegionStoreManager::getBinding()` even if `T` was non-null, we replaced it with `TVR->getValueType()` in case the `MR` was `TypedValueRegion`.
IMO we shouldn't overwrite the type unless we actually need to auto-detect the binding type.

This was particularly wrong when we reinterpret-cast some typed memory region (such as a stack-local variable's address) to something else while operating on the store.

---

So, in this new version, I'm proposing to do auto-detection only if the type was null.

---

I haven't done any measurements yet, but I'm still curious about what you think about this.

TODO: Update the summary&title accordingly, if we agree with this direction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136603

Files:
  clang/lib/StaticAnalyzer/Core/RegionStore.cpp
  clang/test/Analysis/ptr-arith.cpp
  clang/test/Analysis/svalbuilder-float-cast.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136603.471112.patch
Type: text/x-patch
Size: 4520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221027/f5e73e4f/attachment.bin>


More information about the cfe-commits mailing list