Skip to content

Commit

Permalink
Force gcc to treate Replay tool object as POD
Browse files Browse the repository at this point in the history
By type casting the pointer to an AllocatorTableEntry to be 'void*',
this will circumvent the typecheck being done by gcc 8 or higher to
determine whether the object is a POD or not. (see:
dotnet/runtime#12684)

Prior to this change, this warning would be triggered in GCC 10.2.1:
  error: 'void* memset(void*, int, size_t)' clearing an object of
  non-trivial type`

It is unclear why gcc is considering this POD to be non-trivial.
  • Loading branch information
mcfadden8 authored and davidbeckingsale committed Sep 23, 2021
1 parent 77a0682 commit f9640e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/replay/ReplayInterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void ReplayInterpreter::buildOperations()

hdr = m_ops->getOperationsTable();
hdr->num_allocators = 0;
memset(hdr->allocators, 0, sizeof(hdr->allocators));
memset(static_cast<void*>(hdr->allocators), 0, sizeof(hdr->allocators));
op = &hdr->ops[0];
memset(op, 0, sizeof(*op));
op->op_type = ReplayFile::otype::ALLOCATE;
Expand Down

0 comments on commit f9640e0

Please sign in to comment.