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

            Bug ID: 86125
           Summary: missing -Wbuiltin-declaration-mismatch on a mismatched
                    return type
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

GCC correctly diagnoses the strdup() declaration that differs from the
corresponding built-in in the type of its argument but fails to issue the same
warning for the declaration of strlen() that differs from the built-in in the
return type.

$ cat c.c && gcc -S -Wall c.c
char* strdup (int);            // warning (good)
char* strlen (const char*);    // missing warning

char* f (void)
{
  return strlen ("123");
}
c.c:1:7: warning: conflicting types for built-in function ‘strdup’
[-Wbuiltin-declaration-mismatch]
 char* strdup (int);            // warning (good)
       ^~~~~~

Reply via email to