https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87489

--- Comment #5 from Andrew Church <achurch+gcc at achurch dot org> ---
Simpler testcase (based on the testcase in bug 87041):

extern int strcmp(const char *a, const char *b) __attribute__((nonnull(1, 2)));
int foo(void) {
    const char * const s = 0;
    if (s)
        return strcmp(s, "");
    else
        return 2;
}

foo.c: In function 'foo':
foo.c:5:16: warning: null argument where non-null required (argument 1)
[-Wnonnull]
         return strcmp(s, "");
                ^~~~~~

Reply via email to