[clang] [Clang] Mark this pointer in destructors dead_on_return (PR #166276)
Thurston Dang via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 12:47:01 PST 2025
thurstond wrote:
> > Is the potential undefined behavior here checked by msan? Do we need to disable adding this attribute if msan is enabled?
>
> Yes, use-after-destroy is checked by msan, but I don't believe we need to explicitly disable anything here to handle msan. Based on my understand, the msan instrumentation will add a call to `__sanitizer_dtor_callback_fields` at the end of the destructor, passing in the `this` pointer along with the object size.
This is my understanding as well.
> `__sanitizer_dtor_callback_fields` then modifies the shadow memory, which is a separate object that is not marked dead by this change.
Yep, shadow memory is opaque to the clang backend - the shadow is just a big blob of memory (~16TB on x86-64), not a bunch of objects.
https://github.com/llvm/llvm-project/pull/166276
More information about the cfe-commits
mailing list