[PATCH] D98798: Produce warning for performing pointer arithmetic on a null pointer.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 12 11:17:29 PDT 2021


efriedma added a comment.

@thakis if this is an issue for you, please revert; like you said, we can figure out the issues later.

Looking at the warning you showed, we might want to consider suppressing that specific pattern, in addition to (or instead of?) suppressing it in system headers. The null pointer subtraction is the least of the problems in `(char*)&((struct S*)0)->member - (char*)0`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98798



More information about the cfe-commits mailing list