[PATCH] D34166: Fix alignment complaint.

Eric Beckmann via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 13:36:05 PDT 2017


ecbeckmann created this revision.
Herald added a subscriber: hiraditya.

Apparently we need to write using a void* pointer on some architectures, or else alignment error is caused.


https://reviews.llvm.org/D34166

Files:
  llvm/lib/Object/WindowsResource.cpp


Index: llvm/lib/Object/WindowsResource.cpp
===================================================================
--- llvm/lib/Object/WindowsResource.cpp
+++ llvm/lib/Object/WindowsResource.cpp
@@ -598,9 +598,8 @@
 
 void WindowsResourceCOFFWriter::writeStringTable() {
   // Just 4 null bytes for the string table.
-  auto COFFStringTable =
-      reinterpret_cast<uint32_t *>(BufferStart + CurrentOffset);
-  *COFFStringTable = 0;
+  auto COFFStringTable = reinterpret_cast<void *>(BufferStart + CurrentOffset);
+  memset(COFFStringTable, 0, 4);
 }
 
 void WindowsResourceCOFFWriter::writeDirectoryTree() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34166.102394.patch
Type: text/x-patch
Size: 606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/e8281ab3/attachment.bin>


More information about the llvm-commits mailing list