This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/17308] nonnull attribute not as useful as it could
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 25 Apr 2012 20:00:44 +0000
- Subject: [Bug middle-end/17308] nonnull attribute not as useful as it could
- Auto-submitted: auto-generated
- References: <bug-17308-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308
--- Comment #9 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> 2012-04-25 20:00:44 UTC ---
(In reply to comment #8)
> 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.
GCC does not warn about unreachable code anymore:
http://gcc.gnu.org/ml/gcc-help/2011-05/msg00360.html
Someone would have to contribute a new -Wunreachable-code implementation. I
honestly don't know what kind of implementation would be acceptable by GCC
maintainers. Maybe one implemented in the FE? If so, it would require exactly
the same infrastructure necessary to implement what Ulrich asks for above.
Sorry, comment #7 still applies.