[llvm-commits] CVS: llvm/lib/Target/TargetSchedInfo.cpp

Misha Brukman brukman at cs.uiuc.edu
Mon Aug 4 18:49:01 PDT 2003


Changes in directory llvm/lib/Target:

TargetSchedInfo.cpp updated: 1.9 -> 1.10

---
Log message:

ElectricFence found this bug where we were reading past the vector boundary.


---
Diffs of the changes:

Index: llvm/lib/Target/TargetSchedInfo.cpp
diff -u llvm/lib/Target/TargetSchedInfo.cpp:1.9 llvm/lib/Target/TargetSchedInfo.cpp:1.10
--- llvm/lib/Target/TargetSchedInfo.cpp:1.9	Sat Dec 28 21:13:00 2002
+++ llvm/lib/Target/TargetSchedInfo.cpp	Mon Aug  4 18:48:40 2003
@@ -243,7 +243,7 @@
 	// for that resource in each cycle.
 	std::vector<resourceId_t>& rvec = this->resourcesByCycle[c];
 	int r;
-	for (r = (int) rvec.size(); r >= 0; r--)
+	for (r = rvec.size() - 1; r >= 0; r--)
 	  if (rvec[r] == delta.resourceId)
 	    {// found last entry for the resource
 	      rvec.erase(rvec.begin() + r);





More information about the llvm-commits mailing list