[llvm] r373763 - [Automaton] Fix invalid iterator reference

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 4 10:15:30 PDT 2019


Author: jamesm
Date: Fri Oct  4 10:15:30 2019
New Revision: 373763

URL: http://llvm.org/viewvc/llvm-project?rev=373763&view=rev
Log:
[Automaton] Fix invalid iterator reference

Found by the expensive checks bot.

Modified:
    llvm/trunk/include/llvm/Support/Automaton.h

Modified: llvm/trunk/include/llvm/Support/Automaton.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Automaton.h?rev=373763&r1=373762&r2=373763&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Automaton.h (original)
+++ llvm/trunk/include/llvm/Support/Automaton.h Fri Oct  4 10:15:30 2019
@@ -94,9 +94,8 @@ private:
     // Iterate over all existing heads. We will mutate the Heads deque during
     // iteration.
     unsigned NumHeads = Heads.size();
-    for (auto HeadI = Heads.begin(), HeadE = std::next(Heads.begin(), NumHeads);
-         HeadI != HeadE; ++HeadI) {
-      PathSegment *Head = *HeadI;
+    for (unsigned I = 0; I < NumHeads; ++I) {
+      PathSegment *Head = Heads[I];
       // The sequence of pairs is sorted. Select the set of pairs that
       // transition from the current head state.
       auto PI = lower_bound(Pairs, NfaStatePair{Head->State, 0ULL});




More information about the llvm-commits mailing list