[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 19:09:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78696
--- Comment #9 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Implementation-specific can in practice include cases where the
implementation deviates from the standard (e.g. Windows 3-digit exponents,
though disabling the optimization for floating-point formats should hide
that). It's clearly not a good idea to convert a minor conformance bug in
the library into a buffer overrun by causing a program to allocate enough
memory for the standard output from a format but not enough for what the
library implementation actually outputs.
(It wouldn't surprise me if there are printf implementations whose results
for some floating-point values are not one of the nearest decimals in each
direction and so could take more characters than either of those take in
some cases.)
More information about the Gcc-bugs
mailing list