Source:
#define __USE_MINGW_ANSI_STDIO 1 #define _UNICODE #include <stdio.h> #include <wchar.h> int wmain(int argc, wchar_t *argv[]) { wprintf(L"argc=%d argv[0]=%s", argc, argv[0]); return 0; }
Observed behavior:
> gcc -municode -std=c11 -Wall -Wextra -Werror -pedantic example.c -o example.exe > example.exe argc=1 argv[0]=e
Expected behavior:
GCC emits an error during compilation.
Version:
> gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=D:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/10.1.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-10.1.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran,ada,objc,obj-c++ --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --disable-plugin --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev3, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.1.0 (Rev3, Built by MSYS2 project)
Hello,
Well, I would not say that diagnostic is wrong here. As for
wide-character routine '%s' still represents an array of characters,
means here an array of wchar_t. For futher reading please see
https://man7.org/linux/man-pages/man3/wprintf.3.html
Regards,
Kai
Am Fr., 19. Juni 2020 um 10:48 Uhr schrieb David Macek
elieux@users.sourceforge.net:
Related
Bugs: #846
The diagnostic reports an error in the reverse situation, why should it not report both?
I think I may have missed the point here with the example. Let me try again:
This surely deserves some warnings. :)