diff options
author | Chris Lattner <sabre@nondot.org> | 2001-11-04 21:32:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-11-04 21:32:41 +0000 |
commit | 5cb17410f2fa8c2a3096c5870be9a2bdb26f8850 (patch) | |
tree | 8cbcdbd97aa4dfd284445ec5bffa17d4ad4241c6 /lib/Bytecode/Writer/Writer.cpp | |
parent | b980e1806657912427e311109924ed5212daff07 (diff) |
Fix obscure nasty bug with bytecode writing that could cause the last byte to be dropped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1123 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode/Writer/Writer.cpp')
-rw-r--r-- | lib/Bytecode/Writer/Writer.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp index 87fed4d1b4..d0b2eb40b0 100644 --- a/lib/Bytecode/Writer/Writer.cpp +++ b/lib/Bytecode/Writer/Writer.cpp @@ -225,12 +225,15 @@ void WriteBytecodeToFile(const Module *C, ostream &Out) { const unsigned char *LastPtr = ChunkPtr; while (I != E) { const unsigned char *ThisPtr = &*++I; - if (LastPtr+1 != ThisPtr) break;// Advanced by more than a byte of memory? + if (LastPtr+1 != ThisPtr) { // Advanced by more than a byte of memory? + ++LastPtr; + break; + } LastPtr = ThisPtr; } // Write out the chunk... - Out.write(ChunkPtr, LastPtr-ChunkPtr+(I != E)); + Out.write(ChunkPtr, LastPtr-ChunkPtr); } Out.flush(); |