[Bug middle-end/78703] -fprintf-return-value floating point handling incorrect in locales with a mulltibyte decimal point
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Dec 7 08:12:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78703
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For -fprintf-return-value, it is desirable to count with the worst case, but
I'm not sure it is the right behavior for the warning. If we are aware of just
1 and 2 byte decimal points in the wild, forcing anyone that uses sprintf or
snprintf to change the lengths of their buffers through warnings to reserve
MB_LEN_MAX (e.g. for glibc 16) bytes for the decimal point just in case is IMHO
just too much. It would be better to use (weak) maximum of 2 rather than 16.
Otherwise people will just disable this warning as counting something that is
totally off. Even the counting of 2 rather than 1 byte for the decimal point
might upset people that always invoke *printf* in the C locale (on the other
side, for programs that invoke it in user selected locale might point to real
bugs that only show up in the Pashto locale).
More information about the Gcc-bugs
mailing list