Fix a bug found by inspection.
authorDan Gohman <gohman@apple.com>
Wed, 25 Aug 2010 20:20:21 +0000 (20:20 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 25 Aug 2010 20:20:21 +0000 (20:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112081 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Bitcode/Reader/BitcodeReader.cpp

index 96b7f4d22dc536aec656cf724f036265464caa37..63c85974e45496a7685487f7e1aaa98e917ef2ad 100644 (file)
@@ -2323,7 +2323,7 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {
     if (A->getParent() == 0) {
       // We found at least one unresolved value.  Nuke them all to avoid leaks.
       for (unsigned i = ModuleValueListSize, e = ValueList.size(); i != e; ++i){
-        if ((A = dyn_cast<Argument>(ValueList.back())) && A->getParent() == 0) {
+        if ((A = dyn_cast<Argument>(ValueList[i])) && A->getParent() == 0) {
           A->replaceAllUsesWith(UndefValue::get(A->getType()));
           delete A;
         }