https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
Eric Gallager changed:
What|Removed |Added
CC||egallager at gcc dot gnu.org
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
--- Comment #7 from Jonathan Wakely ---
Lots of functions have such requirements and make it the caller's
responsibility to meet those requirements.
GCC is not a static analyser, you can't expect warnings about every possible
bug in your code.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
--- Comment #6 from Jonny Grant ---
Jonathan, This is a good point. Where is best to document it?
It's very useful to have these warnings, and I was unaware that -Wall would not
turn on such a necessary feature, or -O2
Could there be overall doc
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
--- Comment #5 from Jonathan Wakely ---
Why add it there and not to every other warning option that depends on
interprocedural analysis and inlining?
If the dereference and the null pointer are in separate files, then of course
the compiler can'
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
--- Comment #4 from Jonny Grant ---
Thank you for your replies!
Could the -flto tip be added to the -Wnull-dereference documentation?
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
Jonathan Wakely changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
--- Comment #2 from Jonathan Wakely ---
That's how C++ works. Each translation unit is compiled separately. It's your
job to prevent such errors.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86177
--- Comment #1 from Jonny Grant ---
If g++ compiles both main.cpp and main2.cpp at the same time (ie no separate
obj file stage) it also doesn't give the expected warning.
jonny@asus:~/code$ g++-8 -O2 -Wall -Wextra -Wnull-dereference -Wpedantic