Wasn't handling case of when machine move labels were undefined.
authorJim Laskey <jlaskey@mac.com>
Wed, 8 Nov 2006 14:16:39 +0000 (14:16 +0000)
committerJim Laskey <jlaskey@mac.com>
Wed, 8 Nov 2006 14:16:39 +0000 (14:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31548 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineDebugInfo.h

index 7b6386730b7c06a2f367a060b77ffbfb8e194ecc..46078d25efa0b609b282b722140f99315650a3fd 100644 (file)
@@ -1046,13 +1046,18 @@ public:
   /// RemapLabel - Indicate that a label has been merged into another.
   ///
   void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) {
+    assert(0 < OldLabelID && OldLabelID <= LabelIDList.size() &&
+          "Old debug label ID out of range.");
+    assert(NewLabelID <= LabelIDList.size() &&
+          "New debug label ID out of range.");
     LabelIDList[OldLabelID - 1] = NewLabelID;
   }
   
   /// MappedLabel - Find out the label's final ID.  Zero indicates deletion.
   /// ID != Mapped ID indicates that the label was folded into another label.
   unsigned MappedLabel(unsigned LabelID) const {
-    return LabelIDList[LabelID - 1];
+    assert(LabelID <= LabelIDList.size() && "Debug label ID out of range.");
+    return LabelID ? LabelIDList[LabelID - 1] : 0;
   }
 
   /// RecordSource - Register a source file with debug info. Returns an source