This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/17308] New: nonnull attribute not as useful as it could
- From: "drepper at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Sep 2004 20:03:06 -0000
- Subject: [Bug middle-end/17308] New: nonnull attribute not as useful as it could
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The nonnull function attribute seems to recognize only null values which are
explicitly passed to the marked function. It would be helpful if deduced values
are also reported. Example:
void *f(void *p) __attribute__((nonnull(1)));
void *bar(void *p)
{
if (p == (void *) 0) return f(p);
return p;
}
There compiler knows that p is NULL in the call of f. The generated code proves
it. Still no warning.
I see the same behavior with gcc 3.5.
--
Summary: nonnull attribute not as useful as it could
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: drepper at redhat dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17308