[llvm] r178166 - Avoid undefined behavior from passing a std::vector's own contents
Dan Gohman
dan433584 at gmail.com
Wed Mar 27 11:44:56 PDT 2013
Author: djg
Date: Wed Mar 27 13:44:56 2013
New Revision: 178166
URL: http://llvm.org/viewvc/llvm-project?rev=178166&view=rev
Log:
Avoid undefined behavior from passing a std::vector's own contents
in as an argument to push_back.
Modified:
llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenSchedule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenSchedule.cpp?rev=178166&r1=178165&r2=178166&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenSchedule.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenSchedule.cpp Wed Mar 27 13:44:56 2013
@@ -1105,7 +1105,9 @@ void PredTransitions::getIntersectingVar
// Push another copy of the current transition for more variants.
Variant.TransVecIdx = TransVec.size();
IntersectingVariants.push_back(Variant);
- TransVec.push_back(TransVec[TransIdx]);
+
+ PredTransition Trans = TransVec[TransIdx];
+ TransVec.push_back(Trans);
}
}
}
More information about the llvm-commits
mailing list