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] New: nonnull attribute not as useful as it could


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


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