[Bug tree-optimization/78696] [7 Regression] -fprintf-return-value misoptimizes %.Ng where N is greater than 10
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 6 17:28:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78696
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
The radix character is not a POSIX extension. See the C11 7.1.1#2: "The
decimal-point character is the character used by functions that convert
floating-point numbers to or from character sequences to denote the
beginning of the fractional part of such character sequences. 180) It is
represented in the text and examples by a period, but may be changed by
the setlocale function." (that wording dates back to C90). It's grouping,
indicated by the ' flag, that's a POSIX extension.
I tend to agree that this option is not yet ready to enable by default.
It also risks introducing buffer overruns on systems where printf doesn't
quite follow the standard interpretation followed by the implementation of
the option. (E.g. some versions of Windows printf functions always use a
3-digit exponent even when standard C would require a 2-digit exponent.
Do you allow for that?)
More information about the Gcc-bugs
mailing list