This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/77298] -Wnonnull-compare only emitted for code which is invoked
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 19 Aug 2016 16:48:09 +0000
- Subject: [Bug c++/77298] -Wnonnull-compare only emitted for code which is invoked
- Authentication-results: sourceware.org; auth=none
- Auto-submitted: auto-generated
- References: <bug-77298-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77298
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The warning for proper behavior needs the function being gimplified and in SSA
form, unless the FE start doing that themselves, otherwise it can't generally
determine if an argument is known to be non-NULL or has been reassigned
afterwards and no guarantees are known about it.
Of course, this is quite a special case, because this isn't a parameter one can
change in the function in any way, so theoretically we could warn for this in
the FE.