summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2001-11-04 21:32:41 +0000
committerChris Lattner <sabre@nondot.org>2001-11-04 21:32:41 +0000
commitdc194d54f97b55a9ef70e0e3de10508d346d83b3 (patch)
tree8558b4c170228edffd5560a0a04a707e1a5180e2 /llvm/lib/Bytecode
parent36c5a791530a5c4293a8a29b23a19cc50c5b0991 (diff)
downloadbcm5719-llvm-dc194d54f97b55a9ef70e0e3de10508d346d83b3.tar.gz
bcm5719-llvm-dc194d54f97b55a9ef70e0e3de10508d346d83b3.zip
Fix obscure nasty bug with bytecode writing that could cause the last byte to be dropped.
llvm-svn: 1123
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r--llvm/lib/Bytecode/Writer/Writer.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Bytecode/Writer/Writer.cpp b/llvm/lib/Bytecode/Writer/Writer.cpp
index 87fed4d1b48..d0b2eb40b05 100644
--- a/llvm/lib/Bytecode/Writer/Writer.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud