[Bug middle-end/87489] Spurious -Wnonnull warning
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 30 17:16:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87489
--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
(In reply to Andrew Church from comment #5)
> Simpler testcase (based on the testcase in bug 87041):
This is a case of the warning being issued by the front end well before dead
code elimination has had a chance to run. The fix is conceptually simple:
remove the warning from the front-end and enhance the middle-end implementation
to handle the cases it doesn't handle, such as:
int foo (int i, const char *s)
{
return strcmp (i ? s : 0, "");
}
But the middle-end implementation of -Wnonnull only runs with optimization
enabled (just after CCP) so the change would have the effect of a large number
of false negatives at -O0. I'm not sure handling the constant test case in
comment #5 is worth it.
More information about the Gcc-bugs
mailing list