[PATCH] D25199: [ubsan] Sanitize deleted pointers

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 3 15:06:38 PDT 2016


vsk added a comment.

In https://reviews.llvm.org/D25199#559849, @pcc wrote:

> It seems to me that this sanitizer would break the semantics of otherwise well-defined programs. For example:
>
>   int *x = nullptr;
>   delete x;
>   if (x != nullptr) {
>     // normally unreachable
>   }
>
>
> It may be that a null comparison would be enough to avoid the semantics break, but I am not certain of this.


Maybe we could call this `-fpoison-dangling-ptrs` and force users to be more explicit about opting into this behavior change. That would remove some of the constraints usually placed on new sanitizer checks (e.g support for executing after the error triggers, support for custom trap functions).


https://reviews.llvm.org/D25199





More information about the cfe-commits mailing list