diff --git a/llvm/include/llvm/Bitcode/BitstreamReader.h b/llvm/include/llvm/Bitcode/BitstreamReader.h index e55910b27ae4..65868294403c 100644 --- a/llvm/include/llvm/Bitcode/BitstreamReader.h +++ b/llvm/include/llvm/Bitcode/BitstreamReader.h @@ -17,6 +17,7 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/Bitcode/BitCodes.h" +#include "llvm/Support/Endian.h" #include "llvm/Support/StreamableMemoryObject.h" #include #include @@ -242,12 +243,13 @@ public: } uint32_t getWord(size_t pos) { - uint32_t word = -1; + uint8_t buf[sizeof(uint32_t)]; + memset(buf, 0xFF, sizeof(buf)); BitStream->getBitcodeBytes().readBytes(pos, - sizeof(word), - reinterpret_cast(&word), + sizeof(buf), + buf, NULL); - return word; + return *reinterpret_cast(buf); } bool AtEndOfStream() {