public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34729]  New: Localization of run-time error messages, written into the executable
@ 2008-01-10 15:09 burnus at gcc dot gnu dot org
  2008-02-01 13:59 ` [Bug fortran/34729] " fxcoudert at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-01-10 15:09 UTC (permalink / raw)
  To: gcc-bugs

I saw that gfortran writes (at least sometimes) a localized run-time error
message:

_gfortran_runtime_error (&"Attempt to allocate a negative amount of
memory."[1]{lb: 1 sz: 1});
_gfortran_os_error (&"Memory allocation failed"[1]{lb: 1 sz: 1});

becomes then (LANG=de_DE.UTF-8):

_gfortran_runtime_error (&"Versuch, einen negativen Betrag von Speicher zu
r"[1]{lb: 1 sz: 1});
_gfortran_os_error (&"Speicherreservierung gesc"[1]{lb: 1 sz: 1});

The first string should be:
"Versuch, einen negativen Betrag von Speicher zu reservieren."
and the second
"Speicherreservierung gescheitert"
one sees that the strings are truncated.

Expected:
Either the localized message should not be truncated - or the English version
of the string should be used throughout.


-- 
           Summary: Localization of run-time error messages, written into
                    the executable
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34729


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34729] Localization of run-time error messages, written into the executable
  2008-01-10 15:09 [Bug fortran/34729] New: Localization of run-time error messages, written into the executable burnus at gcc dot gnu dot org
@ 2008-02-01 13:59 ` fxcoudert at gcc dot gnu dot org
  2008-02-01 14:23 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-01 13:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2008-02-01 13:59 -------
(In reply to comment #0)
> Either the localized message should not be truncated - or the English version
> of the string should be used throughout.

I'm afraid this one has my name on it, as I added localization support to the
front-end. It's really due to stupid lack of thinking on my part:

104372  fxcoudert /* Build a Fortran character constant from a zero-terminated
string.
104372  fxcoudert    Since this is mainly used for error messages, the string
will get
104372  fxcoudert    translated.  */
 88528       tobi tree
104372  fxcoudert gfc_build_cstring_const (const char *msgid)
 88528       tobi {
104372  fxcoudert   return gfc_build_string_const (strlen (msgid) + 1,
_(msgid));
 88528       tobi }


PS: please note that this wouldn't happen if german translation wasn't longer
that the english messages, so maybe I can report that bug upstream to the
maintainer of the German language (is there a German academy for that?): PR
title "German meaning/character ratio is too low", keywork
"missed-optimization".


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-01 13:59:09
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34729


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34729] Localization of run-time error messages, written into the executable
  2008-01-10 15:09 [Bug fortran/34729] New: Localization of run-time error messages, written into the executable burnus at gcc dot gnu dot org
  2008-02-01 13:59 ` [Bug fortran/34729] " fxcoudert at gcc dot gnu dot org
@ 2008-02-01 14:23 ` fxcoudert at gcc dot gnu dot org
  2008-02-25  8:37 ` fxcoudert at gcc dot gnu dot org
  2008-02-25  8:38 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-01 14:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from fxcoudert at gcc dot gnu dot org  2008-02-01 14:22 -------
Created an attachment (id=15073)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15073&action=view)
Patch

I don't think it's a regression, but it certainly is a annoying bug for people
who have a non-english locale. As it's really a one-line patch (well, I've
created a new function and renamed it everywhere, so the diff if big, but the
patch is to use strlen() on the translated string), maybe it would be good to
have it in 4.3 nonetheless. I'll let active maintainers decide.


Here's the ChangeLog that goes with the patch:

2008-02-01  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>

        PR fortran/34729
        * trans-const.c (gfc_build_string_const): Don't call gettext.
        (gfc_build_localized_string_const): New function.
        * trans-const.h (gfc_build_localized_string_const): New prototype.
        * trans.c (gfc_trans_runtime_check): Use
        gfc_build_localized_string_const instead of gfc_build_string_const.
        (gfc_call_malloc): Likewise.
        (gfc_allocate_with_status): Likewise.
        (gfc_allocate_array_with_status): Likewise.
        (gfc_deallocate_with_status): Likewise.
        (gfc_call_realloc): Likewise.
        * trans-io.c (gfc_trans_io_runtime_check): Likewise.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34729


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34729] Localization of run-time error messages, written into the executable
  2008-01-10 15:09 [Bug fortran/34729] New: Localization of run-time error messages, written into the executable burnus at gcc dot gnu dot org
  2008-02-01 13:59 ` [Bug fortran/34729] " fxcoudert at gcc dot gnu dot org
  2008-02-01 14:23 ` fxcoudert at gcc dot gnu dot org
@ 2008-02-25  8:37 ` fxcoudert at gcc dot gnu dot org
  2008-02-25  8:38 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-25  8:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2008-02-25 08:37 -------
Subject: Bug 34729

Author: fxcoudert
Date: Mon Feb 25 08:36:15 2008
New Revision: 132612

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132612
Log:
        PR fortran/34729
        * trans-const.c (gfc_build_string_const): Don't call gettext.
        (gfc_build_localized_string_const): New function.
        * trans-const.h (gfc_build_localized_string_const): New prototype.
        * trans.c (gfc_trans_runtime_check): Use
        gfc_build_localized_string_const instead of gfc_build_string_const.
        (gfc_call_malloc): Likewise.
        (gfc_allocate_with_status): Likewise.
        (gfc_allocate_array_with_status): Likewise.
        (gfc_deallocate_with_status): Likewise.
        (gfc_call_realloc): Likewise.
        * trans-io.c (gfc_trans_io_runtime_check): Likewise.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-const.c
    trunk/gcc/fortran/trans-const.h
    trunk/gcc/fortran/trans-io.c
    trunk/gcc/fortran/trans.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34729


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug fortran/34729] Localization of run-time error messages, written into the executable
  2008-01-10 15:09 [Bug fortran/34729] New: Localization of run-time error messages, written into the executable burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-02-25  8:37 ` fxcoudert at gcc dot gnu dot org
@ 2008-02-25  8:38 ` fxcoudert at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-02-25  8:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2008-02-25 08:37 -------
Fixed on mainline.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34729


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-25  8:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-10 15:09 [Bug fortran/34729] New: Localization of run-time error messages, written into the executable burnus at gcc dot gnu dot org
2008-02-01 13:59 ` [Bug fortran/34729] " fxcoudert at gcc dot gnu dot org
2008-02-01 14:23 ` fxcoudert at gcc dot gnu dot org
2008-02-25  8:37 ` fxcoudert at gcc dot gnu dot org
2008-02-25  8:38 ` fxcoudert at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).