[PATCH] D98798: Produce warning for performing pointer arithmetic on a null pointer.
Jamie Schmeiser via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 27 14:06:03 PDT 2021
jamieschmeiser added a comment.
The reason I worded it with 'may' is because, in C++, nullptr - nullptr is defined. If the code is "nullptr - p" or "p - nullptr", it is only undefined behaviour when p is not nullptr, hence the 'may' part of the warning because this is not known at compile time. The warning is still useful as it is suspect code but one cannot state that it is undefined behaviour because it is valid if it is null at runtime.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D98798/new/
https://reviews.llvm.org/D98798
More information about the cfe-commits
mailing list