public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15992] New: locale ctor throws for all valid locales on SunOS
@ 2004-06-15  0:51 sebor at roguewave dot com
  2004-06-15  0:54 ` [Bug libstdc++/15992] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: sebor at roguewave dot com @ 2004-06-15  0:51 UTC (permalink / raw)
  To: gcc-bugs

The program below behaves differently when compiled with gcc 3.3.2 and 3.4 on
SonOS 5.7: with 3.3.2, libstdc++ successfully constructs all installed locales,
while with 3.4 it fails to construct any at all (other than C and POSIX).

$ cat t.cpp
#include <locale>

int main (int argc, char *argv[])
{
    for (int i = 1; i < argc; ++i) {
        try {
            const std::locale loc (argv [i]);
        }
        catch (std::exception &e) {
            printf ("exception: %s: %s\n", argv [i], e.what ());
        }
    }
}

$ /build/contrib/gcc-3.3.2/bin/g++ --version && /build/contrib/gcc-3.3.2/bin/g++
t.cpp -static && ./a.out `locale -a`
g++ (GCC) 3.3.2
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++ --version && g++ t.cpp -static && ./a.out `locale -a`
g++ (GCC) 3.4.0
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

exception: th_TH: locale::facet::_S_create_c_locale name not valid
exception: th: locale::facet::_S_create_c_locale name not valid
exception: de: locale::facet::_S_create_c_locale name not valid
exception: de.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: de.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: en_AU: locale::facet::_S_create_c_locale name not valid
exception: en_CA: locale::facet::_S_create_c_locale name not valid
exception: en_GB: locale::facet::_S_create_c_locale name not valid
exception: en_GB.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: en_GB.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: en_US: locale::facet::_S_create_c_locale name not valid
exception: es: locale::facet::_S_create_c_locale name not valid
exception: es.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: es.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: es_AR: locale::facet::_S_create_c_locale name not valid
exception: es_BO: locale::facet::_S_create_c_locale name not valid
exception: es_CL: locale::facet::_S_create_c_locale name not valid
exception: es_CO: locale::facet::_S_create_c_locale name not valid
exception: es_CR: locale::facet::_S_create_c_locale name not valid
exception: es_EC: locale::facet::_S_create_c_locale name not valid
exception: es_GT: locale::facet::_S_create_c_locale name not valid
exception: es_MX: locale::facet::_S_create_c_locale name not valid
exception: es_NI: locale::facet::_S_create_c_locale name not valid
exception: es_PA: locale::facet::_S_create_c_locale name not valid
exception: es_PE: locale::facet::_S_create_c_locale name not valid
exception: es_PY: locale::facet::_S_create_c_locale name not valid
exception: es_SV: locale::facet::_S_create_c_locale name not valid
exception: es_UY: locale::facet::_S_create_c_locale name not valid
exception: es_VE: locale::facet::_S_create_c_locale name not valid
exception: fr: locale::facet::_S_create_c_locale name not valid
exception: fr.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: fr.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: it: locale::facet::_S_create_c_locale name not valid
exception: it.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: it.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: sv: locale::facet::_S_create_c_locale name not valid
exception: sv.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: sv.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: en_US.UTF-8: locale::facet::_S_create_c_locale name not valid
exception: bg_BG: locale::facet::_S_create_c_locale name not valid
exception: cz: locale::facet::_S_create_c_locale name not valid
exception: da: locale::facet::_S_create_c_locale name not valid
exception: da.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: de_AT: locale::facet::_S_create_c_locale name not valid
exception: de_AT.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: de_CH: locale::facet::_S_create_c_locale name not valid
exception: el: locale::facet::_S_create_c_locale name not valid
exception: el.sun_eu_greek: locale::facet::_S_create_c_locale name not valid
exception: en_IE: locale::facet::_S_create_c_locale name not valid
exception: en_IE.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: en_NZ: locale::facet::_S_create_c_locale name not valid
exception: et: locale::facet::_S_create_c_locale name not valid
exception: fi: locale::facet::_S_create_c_locale name not valid
exception: fi.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: fr_BE: locale::facet::_S_create_c_locale name not valid
exception: fr_BE.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: fr_CA: locale::facet::_S_create_c_locale name not valid
exception: fr_CH: locale::facet::_S_create_c_locale name not valid
exception: hr_HR: locale::facet::_S_create_c_locale name not valid
exception: hu: locale::facet::_S_create_c_locale name not valid
exception: lt: locale::facet::_S_create_c_locale name not valid
exception: lv: locale::facet::_S_create_c_locale name not valid
exception: mk_MK: locale::facet::_S_create_c_locale name not valid
exception: nl: locale::facet::_S_create_c_locale name not valid
exception: nl.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: nl_BE: locale::facet::_S_create_c_locale name not valid
exception: nl_BE.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: no: locale::facet::_S_create_c_locale name not valid
exception: no_NY: locale::facet::_S_create_c_locale name not valid
exception: nr: locale::facet::_S_create_c_locale name not valid
exception: pl: locale::facet::_S_create_c_locale name not valid
exception: pt: locale::facet::_S_create_c_locale name not valid
exception: pt.ISO8859-15: locale::facet::_S_create_c_locale name not valid
exception: pt_BR: locale::facet::_S_create_c_locale name not valid
exception: ro_RO: locale::facet::_S_create_c_locale name not valid
exception: ru: locale::facet::_S_create_c_locale name not valid
exception: ru.koi8-r: locale::facet::_S_create_c_locale name not valid
exception: sk_SK: locale::facet::_S_create_c_locale name not valid
exception: sl_SI: locale::facet::_S_create_c_locale name not valid
exception: sq_AL: locale::facet::_S_create_c_locale name not valid
exception: sr_SP: locale::facet::_S_create_c_locale name not valid
exception: tr: locale::facet::_S_create_c_locale name not valid
exception: iso_8859_1: locale::facet::_S_create_c_locale name not valid
exception: ar: locale::facet::_S_create_c_locale name not valid
exception: da.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: de.UTF-8: locale::facet::_S_create_c_locale name not valid
exception: de.UTF-8@euro: locale::facet::_S_create_c_locale name not valid
exception: de_AT.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: el.sun_eu_greek@euro: locale::facet::_S_create_c_locale name not valid
exception: en_IE.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: es.UTF-8: locale::facet::_S_create_c_locale name not valid
exception: es.UTF-8@euro: locale::facet::_S_create_c_locale name not valid
exception: fi.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: fr.UTF-8: locale::facet::_S_create_c_locale name not valid
exception: fr.UTF-8@euro: locale::facet::_S_create_c_locale name not valid
exception: fr_BE.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: he: locale::facet::_S_create_c_locale name not valid
exception: he_IL: locale::facet::_S_create_c_locale name not valid
exception: it.UTF-8: locale::facet::_S_create_c_locale name not valid
exception: it.UTF-8@euro: locale::facet::_S_create_c_locale name not valid
exception: nl.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: nl_BE.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: pt.ISO8859-15@euro: locale::facet::_S_create_c_locale name not valid
exception: sv.UTF-8: locale::facet::_S_create_c_locale name not valid
exception: sv.UTF-8@euro: locale::facet::_S_create_c_locale name not valid

-- 
           Summary: locale ctor throws for all valid locales on SunOS
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.7
  GCC host triplet: sparc-sun-solaris2.7
GCC target triplet: sparc-sun-solaris2.7


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


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

* [Bug libstdc++/15992] locale ctor throws for all valid locales on SunOS
  2004-06-15  0:51 [Bug c++/15992] New: locale ctor throws for all valid locales on SunOS sebor at roguewave dot com
@ 2004-06-15  0:54 ` pinskia at gcc dot gnu dot org
  2004-06-15 10:07 ` pcarlini at suse dot de
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-15  0:54 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++


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


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

* [Bug libstdc++/15992] locale ctor throws for all valid locales on SunOS
  2004-06-15  0:51 [Bug c++/15992] New: locale ctor throws for all valid locales on SunOS sebor at roguewave dot com
  2004-06-15  0:54 ` [Bug libstdc++/15992] " pinskia at gcc dot gnu dot org
@ 2004-06-15 10:07 ` pcarlini at suse dot de
  2004-06-15 16:03 ` sebor at roguewave dot com
  2004-06-16  1:17 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2004-06-15 10:07 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-06-15 10:06 -------
Hi Martin. On this platform we are using the 'generic' locale model, right? Not
the 'gnu' locale model that needs glibc.

If you can confirm that the explanation it's easy: basically you cannot really
use named localed in that model, just, 3.4 tells you much sooner!

3.3.2
=====
  void
  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char*, 
				    __c_locale)
  { __cloc = NULL; }

3.4.0
=====
  void
  locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, 
				    __c_locale)
  {
    // Currently, the generic model only supports the "C" locale.
    // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
    __cloc = NULL;
    if (strcmp(__s, "C"))
      __throw_runtime_error(__N("locale::facet::_S_create_c_locale "
			    "name not valid"));
  }

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug libstdc++/15992] locale ctor throws for all valid locales on SunOS
  2004-06-15  0:51 [Bug c++/15992] New: locale ctor throws for all valid locales on SunOS sebor at roguewave dot com
  2004-06-15  0:54 ` [Bug libstdc++/15992] " pinskia at gcc dot gnu dot org
  2004-06-15 10:07 ` pcarlini at suse dot de
@ 2004-06-15 16:03 ` sebor at roguewave dot com
  2004-06-16  1:17 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: sebor at roguewave dot com @ 2004-06-15 16:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From sebor at roguewave dot com  2004-06-15 16:03 -------
Subject: Re:  locale ctor throws for all valid locales
 on SunOS

pcarlini at suse dot de wrote:

> ------- Additional Comments From pcarlini at suse dot de  2004-06-15 10:06 -------
> Hi Martin. On this platform we are using the 'generic' locale model, right? Not
> the 'gnu' locale model that needs glibc.

I suspected as much, I just didn't want to believe it was intentional.
The generic model is pretty much useless.

> 
> If you can confirm that the explanation it's easy: basically you cannot really
> use named localed in that model, just, 3.4 tells you much sooner!

Hmm. I thought 3.3.2 worked reasonably well but it sounds like
I thought wrong.

> 
...
>     // Currently, the generic model only supports the "C" locale.
>     // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html

I remember this thread. I guess maybe I didn't realize back then
that on Solaris libstdc++ used the generic model. Or didn't have
time to respond to the RFC.

FWIW, it's possible to get C++ locale to work on Solaris (or any
other non-glibc platform). It may not be as fast or 100% thread-safe
as when you hook into the C library locale but it works well enough
and is portable enough that I think it outweighs the disadvantages.
With caching, the thread safety is only an issue at facet or locale
initialization time and only in programs that call setlocale()
directly, not when using the facets. Our primary locale model is
implemented this way and its performance is typically within 25%
of stdio.

Martin



-- 


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


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

* [Bug libstdc++/15992] locale ctor throws for all valid locales on SunOS
  2004-06-15  0:51 [Bug c++/15992] New: locale ctor throws for all valid locales on SunOS sebor at roguewave dot com
                   ` (2 preceding siblings ...)
  2004-06-15 16:03 ` sebor at roguewave dot com
@ 2004-06-16  1:17 ` pcarlini at suse dot de
  3 siblings, 0 replies; 5+ messages in thread
From: pcarlini at suse dot de @ 2004-06-16  1:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-06-16 01:17 -------
Ok, Martin, I'll try to think more about your interesting 'FWIW'.
I'm closing this specific PR, however.
Thanks, Paolo.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2004-06-16  1:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-15  0:51 [Bug c++/15992] New: locale ctor throws for all valid locales on SunOS sebor at roguewave dot com
2004-06-15  0:54 ` [Bug libstdc++/15992] " pinskia at gcc dot gnu dot org
2004-06-15 10:07 ` pcarlini at suse dot de
2004-06-15 16:03 ` sebor at roguewave dot com
2004-06-16  1:17 ` pcarlini at suse dot de

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