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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|bug in gfortran runtime on  |bug in gfortran runtime:
                   |OSX: digits cut off when    |digits cut off when reading
                   |reading floating point      |floating point number
                   |number                      |

--- Comment #10 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
I can reproduce this PR on a linux box with gcc version 4.6.3 20120306 (Red Hat
4.6.3-2), so the bug is not darwin specific. 

I have noticed that the file generated by running the test is

1.2345

and does not change if I put the line

        setlocale(LC_ALL, "de_DE.UTF-8");

before the line

        f = fopen("bug.dat", "w");

Now if I change the content of bug.dat to

1,2345

suppress the file generation in bug.c and use

  open(unit=1,file='bug.dat', decimal='comma')

in bugf.f90, running the executable does not give any output (success).

So apparently strtod uses the locale to read 1.2345, giving 1.0 as a result for
"de_DE.UTF-8" (or "fr_FR.UTF-8"), using "en_US.ISO8859-1" gives 1.2345.

The only solution I see is to save the current locale, set it to "C" before
using strtod, and restore it upon completion.

Reply via email to