[PATCH] D87755: Silence GCC's `-Wclass-memaccess` warnings

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 03:40:07 PDT 2020


jhenderson added a comment.

I've made two inline suggestions, but I'm not at all familiar with the other code, so can't further assist there.



================
Comment at: llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp:1719-1720
 
   InternalInstruction Insn;
-  memset(&Insn, 0, sizeof(InternalInstruction));
+  memset((void *)&Insn, 0, sizeof(InternalInstruction));
   Insn.bytes = Bytes;
----------------
This should work, right?


================
Comment at: llvm/tools/llvm-nm/llvm-nm.cpp:1638-1639
           LastSymbolName = Entry.symbolName();
           NMSymbol W;
-          memset(&W, '\0', sizeof(NMSymbol));
+          memset((void *)&W, '\0', sizeof(NMSymbol));
           W.Name = Entry.symbolName();
----------------
Can't you do this here (like in other places earlier in the code)? Not sure the `memset` is actually needed with that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87755/new/

https://reviews.llvm.org/D87755



More information about the llvm-commits mailing list