This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30043] __attribute__((nonull(...))) and silent optimizations
- From: "thutt at vmware dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Dec 2008 15:44:41 -0000
- Subject: [Bug c/30043] __attribute__((nonull(...))) and silent optimizations
- References: <bug-30043-13675@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from thutt at vmware dot com 2008-12-23 15:44 -------
(In reply to comment #1)
> The compiler may also choose to make optimizations based on
> the knowledge that certain function arguments will not be null.
>
> Witeness the last sentence.
If this is the case, then might it not be better for the diagnostic to
be an error rather than a warning? If it's a warning that is not even
printed at the standard level of warnings, then it could be easily argued
that the compiler is generating bad code. In other words, if a parameter
does not meet a required precondition, then the compiler should
issue an error always.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30043