about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorvpushkar <vpushkar@ptsecurity.com>2016-03-16 15:54:26 +0300
committervpushkar <vpushkar@ptsecurity.com>2016-03-16 15:54:26 +0300
commitbfc4714531978867a7f68a52f0b614b63f06a391 (patch)
tree04aa7f6230271735c78645e60e47f6e91fe9b238
parent7366b149824a6c899fa804674574d5b21b5171a6 (diff)
downloadklee-bfc4714531978867a7f68a52f0b614b63f06a391.tar.gz
Wrong std::vector 'values' usage after vector's capacity reserve. It is the error to use [] operator for accessing vector's elements after reserving. In such cases push_back/emplace methods should be used. But in this source code the usage of std::vector is redundant. So vector 'values' was iliminated.
-rw-r--r--lib/Module/PhiCleaner.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/Module/PhiCleaner.cpp b/lib/Module/PhiCleaner.cpp
index 3d8d7867..eff3d495 100644
--- a/lib/Module/PhiCleaner.cpp
+++ b/lib/Module/PhiCleaner.cpp
@@ -40,13 +40,9 @@ bool klee::PhiCleanerPass::runOnFunction(Function &f) {
             break;
 
         if (i!=numBlocks) {
-          std::vector<Value*> values;
-          values.reserve(numBlocks);
-          for (unsigned i=0; i<numBlocks; i++)
-            values[i] = pi->getIncomingValueForBlock(reference->getIncomingBlock(i));
           for (unsigned i=0; i<numBlocks; i++) {
             pi->setIncomingBlock(i, reference->getIncomingBlock(i));
-            pi->setIncomingValue(i, values[i]);
+            pi->setIncomingValue(i, pi->getIncomingValueForBlock(reference->getIncomingBlock(i)));
           }
           changed = true;
         }