[PATCH] D16738: Fix invalid casts in <functional>.
Evgeniy Stepanov via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 1 13:20:59 PST 2016
eugenis added a comment.
In http://reviews.llvm.org/D16738#340175, @EricWF wrote:
> > This also could be fixed in a different way by replacing C-style
>
> > casts with reinterpret_cast<>, which, from my reading of the
>
> > standard, is allowed in this context.
>
>
> I agree that using `void*` to represent raw memory is the better approach than `reinterpret_cast<>()`.
> However I'm concerned that changing the signature (and mangling) of `virtual void __clone(...)` could cause ABI problems.
> I *think* this should be "safe" because the VTable's mangled name doesn't change. but if I'm wrong we must use `reinterpret_cast<>` for calls to `__clone(...)`.
>
> The parts of the patch that don't affect `__clone(...)` LGTM. You can commit them separably if you want.
>
> > That would not help with CFI
>
> > though, which still flags such casts as invalid (yes, it is stricter that the standard).
>
>
> I'm sure there are alternative ways to make CFI shut up. Perhaps we could do the `Buffer* -> Base*` conversion inside a blacklisted function (akin to std::launder)?
> It would also be nice to have "`__attribute__((__no_sanitize__("cfi")))`.
We do have this attribute.
Repository:
rL LLVM
http://reviews.llvm.org/D16738
More information about the cfe-commits
mailing list