[Bug c/16351] NULL dereference warnings

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Feb 17 15:07:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=16351

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |janus at gcc dot gnu.org

--- Comment #53 from janus at gcc dot gnu.org ---
Carrying over the test case from PR 79572:


#include <iostream>

void f(const int &iref) {
  if (&iref)
    std::cout << iref << std::endl;
  else
    std::cout << "iref is NULL" << std::endl;
}

int main () {
  f(*((int*) NULL));
  return 0;
}


This dereferences a NULL pointer in a very explicit fashion, but is not being
caught by -Wnull-dereference, neither with 6.2 nor with current 7-trunk.


More information about the Gcc-bugs mailing list