[MinGW-Notify] [mingw] #43663: %zd and %td support in attribute format printf

Back to archive index
MinGW Notification List mingw****@lists*****
Thu Jan 20 19:09:47 JST 2022


#43663: %zd and %td support in attribute format printf

  Open Date: 2022-01-20 19:09
Last Update: 2022-01-20 19:09

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/43663
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=43663

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-01-20 19:09 Updated by: eric_pouech
 * New Ticket "%zd and %td support in attribute format printf" created


---------------------------------------------------------------------
Ticket Status:

      Reporter: eric_pouech
         Owner: (None)
          Type: Issues
        Status: Open
      Priority: 5 - Medium
     MileStone: (None)
     Component: (None)
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

sample a.c
#include <stddef.h>
int foo(const char*,...) __attribute__((format(printf, 1, 2)));

int main(void)
{
	size_t f = sizeof(size_t);
	return foo("%zd\n", f);
}
this simple program, compiled with -Wall warns about unsupported %zd
$ x86_64-w64-mingw32-gcc a.c -Wall 
a.c: In function 'main':
a.c:7:22: warning: unknown conversion type character 'z' in format [-Wformat=]
    7 |         return foo("%zd\n", f);
      |                      ^
$ i686-w64-mingw32-gcc a.c -Wall 
a.c: In function 'main':
a.c:7:22: warning: unknown conversion type character 'z' in format [-Wformat=]
    7 |         return foo("%zd\n", f);
      |                      ^
whereas gcc compiles the snipnet just fine
version info$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-w64-mingw32/11.2.1/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-threads=posix --with-isl --enable-libgomp --target=x86_64-w64-mingw32 --with-sysroot=/usr/x86_64-w64-mingw32/sys-root --with-gxx-include-dir=/usr/x86_64-w64-mingw32/sys-root/mingw/include/c++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.1 20210728 (Fedora MinGW 11.2.1-3.fc35) (GCC) 
version info$ i686-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-w64-mingw32/11.2.1/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../configure --prefix=/usr --bindir=/usr/bin --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --with-gnu-as --with-gnu-ld --verbose --without-newlib --disable-multilib --disable-plugin --with-system-zlib --disable-nls --without-included-gettext --disable-win32-registry --enable-languages=c,c++,objc,obj-c++,fortran --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-threads=posix --with-isl --enable-libgomp --target=i686-w64-mingw32 --with-sysroot=/usr/i686-w64-mingw32/sys-root --with-gxx-include-dir=/usr/i686-w64-mingw32/sys-root/mingw/include/c++ --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.1 20210728 (Fedora MinGW 11.2.1-3.fc35) (GCC) 
MS compiler supports %zd as the preferred way to print size_t values
(didn't included in the tests, but %td for ptrdiff_t suffers from the same issues)

-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/mingw/ticket/43663
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=43663



More information about the MinGW-Notify mailing list
Back to archive index