Page MenuHomePhabricator

Emiting invariant.group.barrier for ctors bugfix
ClosedPublic

Authored by Prazek on Oct 1 2015, 6:48 PM.

Details

Summary

Please review asap.

This bug caused clang call pure virtual functions when called from constructor body.

Diff Detail

Event Timeline

Prazek updated this revision to Diff 36328.Oct 1 2015, 6:48 PM
Prazek retitled this revision from to Emiting invariant.group.barrier for ctors bugfix.
Prazek updated this object.
Prazek added reviewers: rsmith, nlewycky, rjmccall, majnemer.
Prazek added a subscriber: cfe-commits.
nlewycky edited edge metadata.Oct 1 2015, 6:54 PM

I can't meaningfully review this, but I see nothing wrong here.

lib/CodeGen/CGClass.cpp
1378

"llvm::Value* const" --> "llvm::Value *const"

Prazek updated this revision to Diff 36382.Oct 2 2015, 10:53 AM
Prazek updated this object.
Prazek edited edge metadata.
Prazek marked an inline comment as done.
rsmith accepted this revision.Oct 2 2015, 11:07 AM
rsmith edited edge metadata.

LGTM, but your commit message should be more descriptive than your current summary. Something like:

Ensure that the vptr store in the most-derived constructor is not behind an invariant group barrier. Previously, the base-most vptr store would be the one behind no barrier, and that could result in the creator of the object thinking it had the base-most vtable.

This revision is now accepted and ready to land.Oct 2 2015, 11:07 AM
Prazek closed this revision.Oct 2 2015, 3:25 PM
chapuni added a subscriber: chapuni.Oct 2 2015, 5:54 PM
chapuni added inline comments.
test/CodeGenCXX/strict-vtable-pointers.cpp
145

You missed "%2" (should be THIS3). Fixed in r249223.

Prazek added a subscriber: Prazek.Oct 2 2015, 6:44 PM

Thank you!