diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index 6f028fba000..86a26c2c20e 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/include/llvm/Bitcode/BitstreamReader.h @@ -101,7 +101,9 @@ public: } } - bool AtEndOfStream() const { return NextChar == LastChar; } + bool AtEndOfStream() const { + return NextChar == LastChar && BitsInCurWord == 0; + } /// GetCurrentBitNo - Return the bit # of the bit we are reading. uint64_t GetCurrentBitNo() const {