This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/36857] Non-English locale breaks gfortran float formatting ("printf is broken")
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jul 2008 20:45:25 -0000
- Subject: [Bug libfortran/36857] Non-English locale breaks gfortran float formatting ("printf is broken")
- References: <bug-36857-16480@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from burnus at gcc dot gnu dot org 2008-07-16 20:45 -------
> program main
> CALL badlocale()
> WRITE(*,'(G2.4)') 1.2345
> end program main
>
> If the code executed correctly, the expected output would be
> 1,235
No, the expected output would be "1.235" according to the Fortran standard. You
need to use, e.g.,
WRITE(*, '(G2.4)',decimal='comma') 1.2345
to get the "1,235". (decimal="comma" and "dc" are supported since gfortran 4.4
and part for the Fortran 2003 standard.)
However, I agree that gfortran should not print an internal error as setting
the locale might happen in mixed-language programming. The question is only how
to enforce a LC_ALL = "C" for libgfortran's printf calls without causing other
problems such has performance hits.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36857