[PATCH] D48764: [Analyzer] Hotfix for iterator checkers: Mark left-hand side of `SymIntExpr` objects as live in the program state maps.

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 29 04:23:10 PDT 2018


baloghadamsoftware created this revision.
baloghadamsoftware added reviewers: NoQ, mikhail.ramalho.
Herald added subscribers: a.sidorin, dkrupp, rnkovacs, szepet, xazax.hun, whisperity.
Herald added a reviewer: george.karpenkov.

Marking a symbolic expression as live is not recursive. In our checkers we either use conjured symbols or conjured symbols plus/minus concrete integers to represent abstract positions of iterators, so we must mark the left-hand side of these expressions as live to prevent them from getting reaped.


https://reviews.llvm.org/D48764

Files:
  lib/StaticAnalyzer/Checkers/IteratorChecker.cpp


Index: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
+++ lib/StaticAnalyzer/Checkers/IteratorChecker.cpp
@@ -489,12 +489,16 @@
   auto RegionMap = State->get<IteratorRegionMap>();
   for (const auto Reg : RegionMap) {
     const auto Pos = Reg.second;
+    if (const auto *SIE = dyn_cast<SymIntExpr>(Pos.getOffset()))
+      SR.markLive(SIE->getLHS());
     SR.markLive(Pos.getOffset());
   }
 
   auto SymbolMap = State->get<IteratorSymbolMap>();
   for (const auto Sym : SymbolMap) {
     const auto Pos = Sym.second;
+    if (const auto *SIE = dyn_cast<SymIntExpr>(Pos.getOffset()))
+      SR.markLive(SIE->getLHS());
     SR.markLive(Pos.getOffset());
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48764.153466.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180629/034278e2/attachment.bin>


More information about the cfe-commits mailing list