[PATCH] D67122: [UBSan][clang][compiler-rt] Applying non-zero offset to nullptr is undefined behaviour

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 26 12:47:56 PDT 2019


lebedev.ri marked 2 inline comments as done.
lebedev.ri added a comment.





================
Comment at: clang/docs/ReleaseNotes.rst:238
 
-- ...
+- * ``pointer-overflow`` check was extended added to catch the cases where
+    a non-zero offset being applied, either to a ``nullptr``, or the result
----------------
rsmith wrote:
> Reusing this group seems a little surprising, since the new checks don't seem to have anything to do with overflow. Is the general idea that this warning identifies places where pointer artihmetic leaves the complete object (where, for now, we only catch the case where it wraps around the address space or leaves / reaches a hypothetical size-0 object at the null address)?
As it can be seen in the patch history i initially added this as a new group,
but then merged it back into this group as per @vsk request in D67122#inline-602602 :
> Separately, the proposed 'nullptr-and-nonzero-offset' check is interesting only/exactly when the existing 'pointer-overflow' check is interesting, and vice versa. So I don't see the need to make them distinct.

So yes, the idea is that in the retrospect, the `pointer-overflow` name might be just too specific,
but this is the same UB, so there is no point in fragmenting it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67122/new/

https://reviews.llvm.org/D67122





More information about the cfe-commits mailing list