[llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Dec 3 17:22:24 PST 2004



Changes in directory llvm/lib/CodeGen:

LiveInterval.cpp updated: 1.18 -> 1.19
---
Log message:

Prevent accessing past the end of the intervals vector, this fixes 
Prolang-C/bison in the JIT


---
Diffs of the changes:  (+3 -1)

Index: llvm/lib/CodeGen/LiveInterval.cpp
diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.18 llvm/lib/CodeGen/LiveInterval.cpp:1.19
--- llvm/lib/CodeGen/LiveInterval.cpp:1.18	Wed Nov 17 23:28:21 2004
+++ llvm/lib/CodeGen/LiveInterval.cpp	Fri Dec  3 19:22:09 2004
@@ -74,7 +74,9 @@
     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;
     }






More information about the llvm-commits mailing list