https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108893
--- Comment #5 from Jonny Grant <jg at jguk dot org> --- Here is an example, no warnings during compilation. https://godbolt.org/z/h8E7r3Wf8 #include <cstdlib> // Try get a build warning for nullptr dereference __attribute__ ((access (read_only, 1, 2))) void f(char * s, size_t size); void f(char * s, size_t size) { *s = 'a'; } int main() { char * s = nullptr; f(s, 1); }