[PATCH] D89055: [analyzer] Wrong type cast occures during pointer dereferencing after type punning

Chris Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 7 10:58:42 PDT 2021


chrish_ericsson_atx added inline comments.
Herald added a subscriber: manas.


================
Comment at: clang/lib/StaticAnalyzer/Core/SValBuilder.cpp:763-765
+      if (const auto *ER = dyn_cast<ElementRegion>(R)) {
+        R = StateMgr.getStoreManager().castRegion(ER, CastTy);
+        return loc::MemRegionVal(R);
----------------
This causes new false-positive static analysis warnings from core.CallAndMessage and core.UndefinedBinaryOperatorResult, (and possibly others?), possibly because of loss of array extent information.  See https://bugs.llvm.org/show_bug.cgi?id=50604.  



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89055



More information about the cfe-commits mailing list