[llvm] r305541 - Fix msan buildbot.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 19:17:35 PDT 2017


Author: ruiu
Date: Thu Jun 15 21:17:35 2017
New Revision: 305541

URL: http://llvm.org/viewvc/llvm-project?rev=305541&view=rev
Log:
Fix msan buildbot.

This patch should fix sanitizer-x86_64-linux-fast bot.

The problem was that the contents of this stream are aligned to 4 byte,
and the paddings were created just by incrementing `Offset`, so paddings
had undefined values. When the entire stream is written to an output,
it triggered msan.

Modified:
    llvm/trunk/lib/Support/BinaryStreamWriter.cpp

Modified: llvm/trunk/lib/Support/BinaryStreamWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/BinaryStreamWriter.cpp?rev=305541&r1=305540&r2=305541&view=diff
==============================================================================
--- llvm/trunk/lib/Support/BinaryStreamWriter.cpp (original)
+++ llvm/trunk/lib/Support/BinaryStreamWriter.cpp Thu Jun 15 21:17:35 2017
@@ -83,6 +83,7 @@ Error BinaryStreamWriter::padToAlignment
   uint32_t NewOffset = alignTo(Offset, Align);
   if (NewOffset > getLength())
     return make_error<BinaryStreamError>(stream_error_code::stream_too_short);
-  Offset = NewOffset;
+  while (Offset < NewOffset)
+    writeInteger('\0');
   return Error::success();
 }




More information about the llvm-commits mailing list