[llvm] r305320 - Fix alignment complaint.

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


Author: ecbeckmann
Date: Tue Jun 13 15:36:19 2017
New Revision: 305320

URL: http://llvm.org/viewvc/llvm-project?rev=305320&view=rev
Log:
Fix alignment complaint.

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

Subscribers: hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D34166

Modified:
    llvm/trunk/lib/Object/WindowsResource.cpp

Modified: llvm/trunk/lib/Object/WindowsResource.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WindowsResource.cpp?rev=305320&r1=305319&r2=305320&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp (original)
+++ llvm/trunk/lib/Object/WindowsResource.cpp Tue Jun 13 15:36:19 2017
@@ -598,9 +598,8 @@ void WindowsResourceCOFFWriter::writeSym
 
 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() {




More information about the llvm-commits mailing list