public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/12859] New: Output of floating point value changes global lokale
@ 2003-10-31 16:02 pthomas at suse dot de
  2003-10-31 16:03 ` [Bug libstdc++/12859] " pthomas at suse dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: pthomas at suse dot de @ 2003-10-31 16:02 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Output of floating point value changes global lokale
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pthomas at suse dot de
                CC: aj at suse dot de,gcc-bugs at gcc dot gnu dot org

Putting out a floating point value seems to change the global C locale. Just
compile and run the attached test program and you'll see that the last call
to isalpha returns false instead of the expected true. If you comment out the
line that outputs the fp value, isalpha returns true as expected.

3.3.1 and 3.3.2 also have the same bug that I consider quite nasty and 
unexpected.


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

* [Bug libstdc++/12859] Output of floating point value changes global lokale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
@ 2003-10-31 16:03 ` pthomas at suse dot de
  2003-10-31 16:22 ` pthomas at suse dot de
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pthomas at suse dot de @ 2003-10-31 16:03 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pthomas at suse dot de  2003-10-31 16:02 -------
Created an attachment (id=5027)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5027&action=view)
Testcase that shows the libstdc++ bug


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

* [Bug libstdc++/12859] Output of floating point value changes global lokale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
  2003-10-31 16:03 ` [Bug libstdc++/12859] " pthomas at suse dot de
@ 2003-10-31 16:22 ` pthomas at suse dot de
  2003-10-31 20:40 ` paolo at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pthomas at suse dot de @ 2003-10-31 16:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pthomas at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   GCC host triplet|                            |x86_64-suse-linux


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

* [Bug libstdc++/12859] Output of floating point value changes global lokale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
  2003-10-31 16:03 ` [Bug libstdc++/12859] " pthomas at suse dot de
  2003-10-31 16:22 ` pthomas at suse dot de
@ 2003-10-31 20:40 ` paolo at gcc dot gnu dot org
  2003-10-31 23:12 ` [Bug libstdc++/12859] Output of floating point value changes global locale paolo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-10-31 20:40 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


paolo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |paolo at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-10-31 20:39:07
               date|                            |


------- Additional Comments From paolo at gcc dot gnu dot org  2003-10-31 20:39 -------
Hi,

I can reproduce it and construct a pure "C" testcase in this sense: in v3
we use glibc uselocale assuming the the semantics is such that the below
outputs 0, 1024, 0, 1024 *not* 0, 1024, 0, 0 !!

#define _GNU_SOURCE 1
#include <locale.h>
#include <stdio.h>

int main()
{
  __locale_t    loc_new, loc_old;
  
  printf("%d\n", isalpha(0xE4));  // 0

  setlocale ( LC_ALL, "de_DE" );
  printf("%d\n", isalpha(0xE4));  // 1024

  loc_new = newlocale(1 << LC_ALL, "C", 0);
  loc_old = uselocale(loc_new);

  printf("%d\n", isalpha(0xE4));  // 0
  
  uselocale(loc_old);

  printf("%d\n", isalpha(0xE4));  // 0 *not* 1024!

  freelocale(loc_new);
  return 0;
}

What are we doing wrong?? Why the (global) de_DE locale is not restored for
the current thread by the second uselocale?

I hope to sort this out before leaving to Nuremberg!
Paolo.


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

* [Bug libstdc++/12859] Output of floating point value changes global locale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
                   ` (2 preceding siblings ...)
  2003-10-31 20:40 ` paolo at gcc dot gnu dot org
@ 2003-10-31 23:12 ` paolo at gcc dot gnu dot org
  2003-11-01  7:26 ` paolo at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-10-31 23:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From paolo at gcc dot gnu dot org  2003-10-31 22:24 -------
Another observation: actually, only the behavior of isalpha changes (and probably
that of all the other functions provided also in the *_l version by glibc2.3.*)
whereas the thread local locale is properly restored to de_DE after the formatted
output: try a sequence of 3 printf("%f\n", 1.2) instead and you will notice that
the third one, correctly (as prescribed by the de_DE locale, that is) prints the
decimal separator as a comma, not as a dot!


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

* [Bug libstdc++/12859] Output of floating point value changes global locale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
                   ` (3 preceding siblings ...)
  2003-10-31 23:12 ` [Bug libstdc++/12859] Output of floating point value changes global locale paolo at gcc dot gnu dot org
@ 2003-11-01  7:26 ` paolo at gcc dot gnu dot org
  2003-11-15  7:51 ` jlquinn at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-11-01  7:26 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


paolo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |SUSPENDED


------- Additional Comments From paolo at gcc dot gnu dot org  2003-11-01 07:26 -------
Hi again. I have got this reply from Roland McGrath (glibc maintainer):

>No confusion, just a bug.  I've fixed it.  The bug affected ctype functions
>after uselocale (LC_GLOBAL_LOCALE), but not other uses of locale data.
>
>
>Thanks,
>Roland

So, indeed, it's a glibc bug. Unfortunately, it will not be publically
corrected 'til glibc2.3.3, I'm afraid, and I don't think is in our policy
putting in workarounds, in such cases... I'm open to suggestions, however!

Paolo.


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

* [Bug libstdc++/12859] Output of floating point value changes global locale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
                   ` (4 preceding siblings ...)
  2003-11-01  7:26 ` paolo at gcc dot gnu dot org
@ 2003-11-15  7:51 ` jlquinn at gcc dot gnu dot org
  2004-04-15 21:41 ` pcarlini at suse dot de
  2004-08-23  8:55 ` pcarlini at suse dot de
  7 siblings, 0 replies; 9+ messages in thread
From: jlquinn at gcc dot gnu dot org @ 2003-11-15  7:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jlquinn at gcc dot gnu dot org  2003-11-15 07:51 -------
If we get floating point printing in place that doesn't rely on sprintf anymore,
this issue should disappear for float output.  Mucking with the global locale is
only necessary to ensure correct sprintf behavior.

-- 


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


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

* [Bug libstdc++/12859] Output of floating point value changes global locale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
                   ` (5 preceding siblings ...)
  2003-11-15  7:51 ` jlquinn at gcc dot gnu dot org
@ 2004-04-15 21:41 ` pcarlini at suse dot de
  2004-08-23  8:55 ` pcarlini at suse dot de
  7 siblings, 0 replies; 9+ messages in thread
From: pcarlini at suse dot de @ 2004-04-15 21:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-04-15 20:14 -------
*** Bug 14970 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |svoboda at cs dot cmu dot
                   |                            |edu


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


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

* [Bug libstdc++/12859] Output of floating point value changes global locale
  2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
                   ` (6 preceding siblings ...)
  2004-04-15 21:41 ` pcarlini at suse dot de
@ 2004-08-23  8:55 ` pcarlini at suse dot de
  7 siblings, 0 replies; 9+ messages in thread
From: pcarlini at suse dot de @ 2004-08-23  8:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-08-23 08:55 -------
I guess we can close this one: 17140 tracks the specific issue with new floating
point output code.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|SUSPENDED                   |RESOLVED
         Resolution|                            |WONTFIX


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


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

end of thread, other threads:[~2004-08-23  8:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-31 16:02 [Bug libstdc++/12859] New: Output of floating point value changes global lokale pthomas at suse dot de
2003-10-31 16:03 ` [Bug libstdc++/12859] " pthomas at suse dot de
2003-10-31 16:22 ` pthomas at suse dot de
2003-10-31 20:40 ` paolo at gcc dot gnu dot org
2003-10-31 23:12 ` [Bug libstdc++/12859] Output of floating point value changes global locale paolo at gcc dot gnu dot org
2003-11-01  7:26 ` paolo at gcc dot gnu dot org
2003-11-15  7:51 ` jlquinn at gcc dot gnu dot org
2004-04-15 21:41 ` pcarlini at suse dot de
2004-08-23  8:55 ` 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).