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: unassig...@gcc.gnu.org ReportedBy: e...@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.