[Bug middle-end/17308] nonnull attribute not as useful as it could
mark at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 11 21:51:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308
Mark Wielaard <mark at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mark at gcc dot gnu.org
--- Comment #11 from Mark Wielaard <mark at gcc dot gnu.org> ---
(In reply to Eric Blake from comment #8)
> In other words, with a header like:
>
> void foo(void *bar) __attribute__((nonnull(1)));
>
> and a C file like:
>
> void foo(void *bar) { if (!bar) abort(); }
>
> Even if you decide that you are unable to warn about a call to foo(var)
> because the only way to analyze that var might be NULL is in the middle end
> but the warning is only emitted by the front end, AT LEAST you could have
> warned that the 'if (!bar)' conditional is assumed to be dead code based on
> the attribute placed on var.
This part has now been implemented:
https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00626.html
More information about the Gcc-bugs
mailing list