[Bug middle-end/83557] missing last char in printf fmt string
x37a5709 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Dec 24 08:55:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83557
--- Comment #2 from m68k <x37a5709 at gmail dot com> ---
Thanks for the feedback of this forgotten/unexpected behavior.
The funny part of this is, that the rules are not easy to adopt
see what printf("%c\r\n", 'A');
5 .LC1:
6 0002 25630D0A .string "%c\r\n" <--printf("%c\r\n", 'A');
6 00
HERE \n is maintained, not taking into account puts behavior!!
\n is also maintained in some semantic wrong but syntax correct statement
see:
printf("\r\n"); with printf("\r\n", ' ');
3 .LC0:
4 0000 0D00 .string "\r" <---printf("\r\n");
5 .LC1:
6 0002 0D0A00 .string "\r\n" <---printf("\r\n", ' ');
and \n is also maintained when \n not at the end of a string
and see what printf("\n\r");
11 .LC4:
12 000d 0A0D00 .string "\n\r" <---printf("\n\r)");
More information about the Gcc-bugs
mailing list