Page MenuHomePhabricator

[clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1
ClosedPublic

Authored by kcc on Nov 6 2014, 6:01 PM.

Diff Detail

Event Timeline

kcc updated this revision to Diff 15904.Nov 6 2014, 6:01 PM
kcc retitled this revision from to [clang/asan] Do not emit memcpy for trivial operator= when -fsanitize-address-field-padding >= 1.
kcc updated this object.
kcc edited the test plan for this revision. (Show Details)
kcc added reviewers: majnemer, rsmith.
kcc added a subscriber: Unknown Object (MLST).
rsmith accepted this revision.Nov 11 2014, 3:24 PM
rsmith edited edge metadata.

LGTM, assuming the answer to my question is 'no'.

lib/CodeGen/CGExprCXX.cpp
321

Is mayInsertExtraPadding ever true for a union? The non-memcpy path will not do the right thing for a trivial assignment operator in that case.

This revision is now accepted and ready to land.Nov 11 2014, 3:24 PM
kcc added inline comments.Nov 11 2014, 3:28 PM
lib/CodeGen/CGExprCXX.cpp
321

It is never true:

bool RecordDecl::mayInsertExtraPadding(bool EmitRemark) const {
...

else if (CXXRD->isUnion())
  ReasonToReject = 2;  // is a union.
kcc closed this revision.Nov 11 2014, 3:29 PM