[Bug middle-end/87489] Spurious -Wnonnull warning

achurch+gcc at achurch dot org gcc-bugzilla@gcc.gnu.org
Wed Oct 31 01:44:00 GMT 2018


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

--- Comment #7 from Andrew Church <achurch+gcc at achurch dot org> ---
Would it be reasonable to have the FE warning trigger only on a literal null
value and not on variables whose values are known to be null?  I don't know the
history behind -Wnonnull warning at two separate points, but if the FE warning
is intended to cover cases in which (for example) argument order is
inadvertently switched to pass an otherwise-reasonable null to a nonnull
parameter, then not warning on variables doesn't seem like it would make much
of a difference.  And I would not expect the compiler to catch data flow bugs
("variable declared as constant null" -> "constant null variable passed to
nonnull function parameter") at -O0 anyway.


More information about the Gcc-bugs mailing list