This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/83557] missing last char in printf fmt string
- From: "x37a5709 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 24 Dec 2017 08:30:38 +0000
- Subject: [Bug middle-end/83557] missing last char in printf fmt string
- Auto-submitted: auto-generated
- References: <bug-83557-4@http.gcc.gnu.org/bugzilla/>
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)");