[PATCH] D74666: Prevent gcc from issuing a warning upon coffnamecpy
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 15 16:46:36 PST 2020
thakis added inline comments.
================
Comment at: llvm/lib/Object/WindowsResource.cpp:724
assert(Src.size() <= COFF::NameSize &&
"Src is not larger than COFF::NameSize");
+ memcpy(Dest, Src.data(), Src.size());
----------------
s/larger/smaller/?
================
Comment at: llvm/lib/Object/WindowsResource.cpp:726
+ memcpy(Dest, Src.data(), Src.size());
+ if(Src.size() < COFF::NameSize)
+ Dest[Src.size()] = '\0';
----------------
Why do we need this if at all? The buffer is initialized to all-zeroes, right? (if not, we'd have to fill all remaining padding with zeroes, not just one byte.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74666/new/
https://reviews.llvm.org/D74666
More information about the llvm-commits
mailing list