[llvm] r206674 - ProfileData: Avoid UB when reading
Justin Bogner
mail at justinbogner.com
Fri Apr 18 17:33:12 PDT 2014
Author: bogner
Date: Fri Apr 18 19:33:12 2014
New Revision: 206674
URL: http://llvm.org/viewvc/llvm-project?rev=206674&view=rev
Log:
ProfileData: Avoid UB when reading
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
Modified: llvm/trunk/include/llvm/ProfileData/InstrProfReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfReader.h?rev=206674&r1=206673&r2=206674&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfReader.h (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfReader.h Fri Apr 18 19:33:12 2014
@@ -222,8 +222,9 @@ public:
static std::pair<offset_type, offset_type>
ReadKeyDataLength(const unsigned char *&D) {
using namespace support;
- return std::make_pair(endian::readNext<offset_type, little, unaligned>(D),
- endian::readNext<offset_type, little, unaligned>(D));
+ offset_type KeyLen = endian::readNext<offset_type, little, unaligned>(D);
+ offset_type DataLen = endian::readNext<offset_type, little, unaligned>(D);
+ return std::make_pair(KeyLen, DataLen);
}
StringRef ReadKey(const unsigned char *D, unsigned N) {
More information about the llvm-commits
mailing list