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

            Bug ID: 119514
           Summary: Incorrect warning: 'I' flag used with '%f' gnu_scanf
                    format [-Wformat=]
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: diagnostic, false-positive
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: macro at orcam dot me.uk
  Target Milestone: ---

Given this program:

$ cat bz13988.c
#include <stdio.h>

int
main (void)
{
  double d;
  scanf ("%Ilf", &d);
  return 0;
}
$ 

I get this warning:

$ gcc -Wall -O2 -o bz13988 bz13988.c
bz13988.c: In function 'main':
bz13988.c:7:14: warning: 'I' flag used with '%f' gnu_scanf format [-Wformat=]
    7 |   scanf ("%Ilf", &d);
      |              ^
$ 

which according to Joseph Myers[1] has been incorrect since support for
the 'I' scanf flag was added for real formats back in 2007.

References:

[1] "stdio-common: Also reject exp char w/o significand in i18n scanf
    [BZ #13988]",
   
<https://inbox.sourceware.org/libc-alpha/6c4e01d3-5dde-464d-ca1b-84d94aea3...@redhat.com/>

Reply via email to