[Bug c/30368] missing warning for dereferencing null pointer

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 19 00:09:56 GMT 2020


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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
                 CC|                            |msebor at gcc dot gnu.org
   Last reconfirmed|2007-03-13 16:12:46         |2020-5-18

--- Comment #9 from Martin Sebor <msebor at gcc dot gnu.org> ---
Missing warning reconfirmed with GCC 11.

The last pass where the null pointer is still available is the CCP1 pass whose
output shows that it removes it:

$ gcc -O2 -S -Wall -Wextra -fdump-tree-ccp1-all=/dev/stdout pr30368.c

...
Substituting values and folding statements

Folding statement: _1 = &a_3->b;
Folded into: _1 = 0B;

Folding statement: if (_1 != 0B)
...

So it should be possible to diagnose the dereference there, just prior to its
removal.


More information about the Gcc-bugs mailing list