[PATCH] D94872: [NFC][AIX][XCOFF] Fix compile warning on strncpy
    Hubert Tong via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Jan 17 06:06:05 PST 2021
    
    
  
hubert.reinterpretcast added inline comments.
================
Comment at: llvm/lib/MC/XCOFFObjectWriter.cpp:102
 struct Section {
-  char Name[XCOFF::NameSize];
+  char Name[XCOFF::NameSize + 1];
   // The physical/virtual address of the section. For an object file
----------------
D71119 changed the type of a local variable as a concession to a false-positive compiler warning (the NUL termination is not required for a name with `NameSize` characters).
Changing the interface of a public member of a class is a more intrusive change. Presumably, we can keep the type of `Name` here as-is and use `memcpy` to populate `Name` after using `strncpy` in the constructor.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94872/new/
https://reviews.llvm.org/D94872
    
    
More information about the llvm-commits
mailing list