diff options
author | Duncan Sands <baldrick@free.fr> | 2009-05-20 15:12:01 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2009-05-20 15:12:01 +0000 |
commit | 0a8fe7a2458f0412bce1ed282fd1a3ca6fdc51bc (patch) | |
tree | c6d932c2ba628e04783531bd19b281d0050b47ff /include/llvm/Analysis/Dominators.h | |
parent | 9b2818d2074efb240b6f1dafbffdfb8c59d828b0 (diff) | |
download | external_llvm-0a8fe7a2458f0412bce1ed282fd1a3ca6fdc51bc.zip external_llvm-0a8fe7a2458f0412bce1ed282fd1a3ca6fdc51bc.tar.gz external_llvm-0a8fe7a2458f0412bce1ed282fd1a3ca6fdc51bc.tar.bz2 |
When comparing DominanceFrontier's, advance iterators
before erasing nodes, not after. Otherwise dom frontier
checking reads from freed memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 35cdb24..0bb98ec 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -968,8 +968,8 @@ public: tmpSet.insert(*I); for (DomSetType::const_iterator I = DS1.begin(), - E = DS1.end(); I != E; ++I) { - BasicBlock *Node = *I; + E = DS1.end(); I != E; ) { + BasicBlock *Node = *I++; if (tmpSet.erase(Node) == 0) // Node is in DS1 but not in DS2. @@ -993,7 +993,7 @@ public: tmpFrontiers.insert(std::make_pair(I->first, I->second)); for (DomSetMapType::iterator I = tmpFrontiers.begin(), - E = tmpFrontiers.end(); I != E; ++I) { + E = tmpFrontiers.end(); I != E; ) { BasicBlock *Node = I->first; const_iterator DFI = find(Node); if (DFI == end()) @@ -1002,6 +1002,7 @@ public: if (compareDomSet(I->second, DFI->second)) return true; + ++I; tmpFrontiers.erase(Node); } |