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

Pierre Ossman <ossman at cendio dot se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ossman at cendio dot se

--- Comment #1 from Pierre Ossman <ossman at cendio dot se> ---
The issue seems to be that gcc assumes that MinGW's printf() (not Microsoft's)
is more strictly POSIX and doesn't support I64. You can easily see this if you
toggle which version is used:

> $ x86_64-w64-mingw32-gcc -D__USE_MINGW_ANSI_STDIO=0 -Wformat -o printf.exe 
> printf.c 
> 
> $ x86_64-w64-mingw32-gcc -D__USE_MINGW_ANSI_STDIO=1 -Wformat -o printf.exe 
> printf.c 
> printf.c: In function 'main':
> printf.c:8:17: warning: 'I' flag used with '%x' gnu_printf format [-Wformat=]
>     8 |     printf("%I64x\n", x);
>       |                 ^
> printf.c:8:17: warning: format '%x' expects argument of type 'unsigned int', 
> but argument 2 has type 'long long unsigned int' [-Wformat=]
>     8 |     printf("%I64x\n", x);
>       |             ~~~~^     ~
>       |                 |     |
>       |                 |     long long unsigned int
>       |                 unsigned int
>       |             %I64llx

Runtime test shows that the warning is incorrect, though. MinGW's printf()
supports I64 just fine.

Issue seen with gcc 14.2.1 here.

Reply via email to