https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78977
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P1 CC| |jakub at gcc dot gnu.org, | |msebor at gcc dot gnu.org Component|c++ |middle-end Target Milestone|--- |7.0 Summary|g++7 snprintf() of double |[7 Regression] g++7 |produces wrong code with |snprintf() of double |-O3 |produces wrong code with | |-O3 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- You haven't provided a self-contained test, so it is hard to know exactly, but I bet it is the -fprintf-return-value optimization. Try -fno-printf-return-value if it helps, if it does, then we really need self-contained small test. Perhaps FreeBSD libc snprintf prints %g differently from what GCC expects, rounds it differently etc.