Prevent accessing past the end of the intervals vector, this fixes
authorChris Lattner <sabre@nondot.org>
Sat, 4 Dec 2004 01:22:09 +0000 (01:22 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 4 Dec 2004 01:22:09 +0000 (01:22 +0000)
Prolang-C/bison in the JIT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18477 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveInterval.cpp

index 54e460f7b46aacaac0c2f705bf8147f920f38598..a8bc1615b4113c364ef2cc462e20607634136fc3 100644 (file)
@@ -74,7 +74,9 @@ bool LiveInterval::overlapsFrom(const LiveInterval& other,
     i = std::upper_bound(i, ie, j->start);
     if (i != ranges.begin()) --i;
   } else if (j->start < i->start) {
-    if ((++StartPos)->start <= i->start) {
+    ++StartPos;
+    if (StartPos != other.end() && StartPos->start <= i->start) {
+      assert(StartPos < other.end() && i < end());
       j = std::upper_bound(j, je, i->start);
       if (j != other.ranges.begin()) --j;
     }