This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/36857] Non-English locale breaks gfortran float formatting ("printf is broken")



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]