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

            Bug ID: 120148
           Summary: -fno-builtin suppresses -Wformat warnings
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: flo2...@eich-krohm.de
  Target Milestone: ---

Reproducer:

extern int printf(const char *, ...);

int main(void)
{
   return printf("%s\n", 10);
}

When compiled with -Wformat like so:

gcc -Wformat test.c
test.c: In function ‘main’:
test.c:5:20: warning: format ‘%s’ expects argument of type ‘char *’, but
argument 2 has type ‘int’ [-Wformat=]

a warning is given as expected.
Adding -fno-builtin to the command line and the warning no longer shows up.

gcc -Wformat -fno-builtin test.c

The order of command line options is irrelevant.

This happens with 15.1.0 built from tarball. It is not new. 11.4.0 also has
this problem.
Observed on x86_64-linux-gnu and s390x-ibm-linux-gnu.

Reply via email to