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

Reply via email to