[Bug c/46936] New: turn __attribute__ ((nonnull (x))) into assert in debug mode
eike@sf-mail.de
gcc-bugzilla@gcc.gnu.org
Tue Dec 14 12:54:00 GMT 2010
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46936
Summary: turn __attribute__ ((nonnull (x))) into assert in
debug mode
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: eike@sf-mail.de
I have this simple function to free a linked list:
void freeips(struct ips *p)
{
while (p) {
struct ips *thisip = p;
p = thisip->next;
free(thisip);
}
}
I accidentially annotated this as __attribute__ ((nonnull (1))) and called it
with a NULL argument. This still worked as long as I was building with -g. Once
I build this in release mode it crashed (correctly). I would like to have some
sort of automatic assert once I annotate a function this way. So when I build
this function annotated and pass NULL I get a meaningful crash and I can debug
this. If I need to explicitely switch this on by a command line switch it's
fine for me.
More information about the Gcc-bugs
mailing list