[PATCH] D28991: [lld] Use %u instead of %d for uint32_t formatting

Hugh Bellamy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 22 11:36:13 PST 2017


hughbe created this revision.
hughbe added a project: lld.

StringTableOff is a `uint32_t`. However, here, we print it as a signed decimal (%d), which is wrong.


Repository:
  rL LLVM

https://reviews.llvm.org/D28991

Files:
  COFF/Writer.cpp


Index: COFF/Writer.cpp
===================================================================
--- COFF/Writer.cpp
+++ COFF/Writer.cpp
@@ -205,7 +205,7 @@
   *Hdr = Header;
   if (StringTableOff) {
     // If name is too long, write offset into the string table as a name.
-    sprintf(Hdr->Name, "/%d", StringTableOff);
+    sprintf(Hdr->Name, "/%u", StringTableOff);
   } else {
     assert(!Config->Debug || Name.size() <= COFF::NameSize);
     strncpy(Hdr->Name, Name.data(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28991.85284.patch
Type: text/x-patch
Size: 476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170122/80ca6aa2/attachment.bin>


More information about the llvm-commits mailing list