[Bug rtl-optimization/87096] "Optimised" snprintf is not POSIX conformant

bugdal at aerifal dot cx gcc-bugzilla@gcc.gnu.org
Wed Dec 12 19:58:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096

--- Comment #10 from Rich Felker <bugdal at aerifal dot cx> ---
Indeed, I think the POSIX requirement is both in conflict with the requirements
of the C language and a bad requirement in itself.

As for what GCC should do, since there room for debate about which behavior is
correct, and library implementations might even continue to disagree/diverge
from one or both of the standards for some time, I do not think GCC should be
overruling the choices made by the library implementation here. The folding for
this case should either happen only for constant size arguments <=INT_MAX, or
should produce a runtime check and force a function call for the case where
it's >INT_MAX.


More information about the Gcc-bugs mailing list