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

--- Comment #2 from Julien Marrec <julien.marrec at gmail dot com> ---
Correction: msvcrt is affected too, just differently. setlocale (LC_NUMERIC,
"C") overwrites its static buffer with "C", so libgfortran always "restores"
"C": a program that sets a non-C LC_NUMERIC is silently reset to "C" by its
first formatted I/O statement. This is deterministic, and goes unnoticed
because most programs never call setlocale.

The Fortran MCVE in the repo now starts from LC_NUMERIC = "French" and checks
that each of 1000 formatted writes restores it, with a function in the output
list that churns the heap during the transfer. With niXman GCC 16.2.0, both
ucrt and msvcrt restore it correctly 0/1000 times
(https://github.com/jmarrec/libgfortran-ucrt-setlocale/actions/runs/40350945265)

Reply via email to