[PATCH] Fix crash in CFGReachabilityAnalysis triggered by IdempotentOperationChecker.

Alexander Kornienko alexfh at google.com
Tue Dec 17 10:42:43 PST 2013


Hi krememek,

CFGReverseBlockReachabilityAnalysis::isReachable is invoked with
CFGBlocks from different CFGs, which leads to an out of bounds access to a
BitVector. I'm not sure whether the method should be called with blocks from
different CFGs. If not, the underlying issue should be fixed and this check
replaced with an assertion.

http://llvm-reviews.chandlerc.com/D2427

Files:
  lib/Analysis/CFGReachabilityAnalysis.cpp

Index: lib/Analysis/CFGReachabilityAnalysis.cpp
===================================================================
--- lib/Analysis/CFGReachabilityAnalysis.cpp
+++ lib/Analysis/CFGReachabilityAnalysis.cpp
@@ -24,6 +24,11 @@
 
 bool CFGReverseBlockReachabilityAnalysis::isReachable(const CFGBlock *Src,
                                           const CFGBlock *Dst) {
+  // FIXME: Should this be an assertion instead?
+  // Src and Dst must be from the same CFG in order to be reachable one from
+  // another.
+  if (Src->getParent() != Dst->getParent())
+    return false;
 
   const unsigned DstBlockID = Dst->getBlockID();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2427.1.patch
Type: text/x-patch
Size: 632 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131217/8eba1ed4/attachment.bin>


More information about the cfe-commits mailing list