https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86102
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is a bad idea, trying to print arbitrary expressions results in them being printed in whatever form the compiler has the expression at the point of the warning, which is often different from what the user wrote. The right thing is to print proper caret, and at least for me I'm getting exactly that, I don't get what you printed, but instead: gcc -S -Wall -W pr86102.c -O2 pr86102.c: In function ‘main’: pr86102.c:7:27: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘char *’ [-Wformat=] printf("result: %zu %zu %zu\n", value, "test", str); ~~^ ~~~~~~ %s pr86102.c:7:31: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘char *’ [-Wformat=] printf("result: %zu %zu %zu\n", value, "test", str); ~~^ ~~~ %s and g++ -S -Wall -W pr86102.C -O2 pr86102.C: In function ‘int main()’: pr86102.C:6:18: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] char * str = "other"; ^~~~~~~ pr86102.C:7:12: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 3 has type ‘const char*’ [-Wformat=] printf("result: %zu %zu %zu\n", value, "test", str); ^~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ pr86102.C:7:12: warning: format ‘%zu’ expects argument of type ‘size_t’, but argument 4 has type ‘char*’ [-Wformat=]