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

2018-12-12 Thread bugdal at aerifal dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #10 from Rich Felker --- 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

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

2018-12-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #9 from Martin Sebor --- (In reply to jos...@codesourcery.com from comment #7) Thanks, that has some useful background.

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

2018-12-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #8 from Martin Sebor --- The POSIX requirement prevents buffer overflow when the size of the destination is incorrectly computed. I realize it's common practice to ignore snprintf return value, but defensively written code should

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

2018-12-12 Thread joseph at codesourcery dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #7 from joseph at codesourcery dot com --- On Wed, 12 Dec 2018, msebor at gcc dot gnu.org wrote: > I find the POSIX requirement to fail when n is greater than INT_MAX to be in > conflict with C. I've submitted a defect to the

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

2018-12-12 Thread bugdal at aerifal dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #6 from Rich Felker --- I don't see how the POSIX requirement makes the function safer. On the contrary, it makes it less safe by introducing failure cases (that an application might fail to check for, assuming it knows it has a good

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

2018-12-12 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #5 from Martin Sebor --- I find the POSIX requirement to fail when n is greater than INT_MAX to be in conflict with C. I've submitted a defect to the Austin Group: http://austingroupbugs.net/view.php?id=1219 At the same time, the

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

2018-08-27 Thread bugdal at aerifal dot cx
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #4 from Rich Felker --- I'm aware, but that makes it an invalid transformation. To be valid, the transformation must only be performed in cases where it's provably not exceptional. The same principle applies to all the pathological

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

2018-08-27 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 --- Comment #3 from Richard Biener --- I don't think we "preserve" exceptional behavior consistently. That is, we happily change code with exceptional behavior to code without if the main computation result is the same.

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

2018-08-26 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 Andrew Pinski changed: What|Removed |Added CC||bugdal at aerifal dot cx --- Comment #2

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

2018-08-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 Martin Sebor changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned

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

2018-08-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87096 Martin Sebor changed: What|Removed |Added Keywords||wrong-code