public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46936] New: turn __attribute__ ((nonnull (x))) into assert in debug mode
@ 2010-12-14 12:54 eike@sf-mail.de
  2013-10-23 13:47 ` [Bug c/46936] " neleai at seznam dot cz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: eike@sf-mail.de @ 2010-12-14 12:54 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-05 14:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-14 12:54 [Bug c/46936] New: turn __attribute__ ((nonnull (x))) into assert in debug mode eike@sf-mail.de
2013-10-23 13:47 ` [Bug c/46936] " neleai at seznam dot cz
2013-10-24  4:05 ` brooks at gcc dot gnu.org
2013-11-05 14:41 ` neleai at seznam dot cz
2013-11-05 14:51 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).