This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/47007] Values from namelist file should not depend on locale settings
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 19 Dec 2010 21:33:13 +0000
- Subject: [Bug fortran/47007] Values from namelist file should not depend on locale settings
- Auto-submitted: auto-generated
- References: <bug-47007-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47007
--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> 2010-12-19 21:32:49 UTC ---
Vaguely related: PR 35862 (rounding on input). Both PR 35862 and this PR seem
to require writing a libgfortran-specific version of
strtof/strtod/strtold/quadmath_strtopQ - currently, the system's version is
called in convert_real.
The only alternatives I see are:
a) To reset the locale for every READ statement ('setlocale(LC_NUMERIC, "C")')
- and restore it afterwards.
b) To use localeconv and convert the decimal sign appropriately in the string
(as currently done for DECIMAL="comma") - again, this needs to happen for every
READ statement
c) Simply document (gfortran.texi) that messing around with "setlocale" might
produce surprising results. [LC_ALL/LANG environment variables do not have any
effect unless "setlocale" is explicitly called. Cf.
http://www.opengroup.org/onlinepubs/007904875/functions/setlocale.html]
I think (a) and (b) are (too) slow and cumbersome and regarding (c): No one
reads the documentation.