When compiling this on MSYS2 UCRT64 with current
mingw-w64-ucrt-x86_64-gcc 12.2.0-10, gcc and g++ results differ:
#include <stdint.h>
#include <stdio.h>
#if !(defined(_UCRT) && !__USE_MINGW_ANSI_STDIO)
#warning unexpected configuration
#endif
void f(size_t s, uint64_t u)
{
// gcc: No warning
// g++: "unknown conversion type character 'z' ..."
printf("%zu", s);
// gcc: "format '%u' expects argument of type 'unsigned int', ..."
// g++: No warning
printf("%I64u", u);
}
This shows that gcc defaults to format 'gnu_printf' but g++ defaults to
format 'ms_printf'.
Is this difference intentional, a MSYS2 packaging issue (i.e. wrong
build parameters, incomplete local patch, ...) or a GCC upstream bug?
Would not be a problem if gcc/g++ would allow to override this attribute
for its builtins.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95130
If !(defined(_UCRT) && !__USE_MINGW_ANSI_STDIO), the problem does not
occur because printf() is a wrapper function which hides the builtin.
--
Regards,
Christian
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public