This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/17308] nonnull attribute not as useful as it could


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]