public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/5110: num_put caches num_punct values
@ 2001-12-13 18:56 sebor
  0 siblings, 0 replies; 5+ messages in thread
From: sebor @ 2001-12-13 18:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5110
>Category:       libstdc++
>Synopsis:       num_put caches num_punct values
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 18:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     sebor@roguewave.com
>Release:        gcc 3.0.1
>Organization:
>Environment:

>Description:
The program below produces unexpected output and fails
with non-0 exit status. The expected output is 

123+456+78+9-1-234-567-89-123/456/789

and the expected exit status is 0. My guess is that it's
because num_put is caching the values supplied by numpunct,
which I don't believe is permitted in Stage 2 in 22.2.2.2.2.

Regards
Martin
>How-To-Repeat:
$ cat t.cpp
#include <iostream>
#include <locale>

int main ()
{
    struct Punct: std::numpunct<char> {
        string_type do_grouping () const {
            static const char *grp = "\1\2\3";
            return grp++;
        }

        char_type do_thousands_sep () const {
            static const char *sep = "+-/";
            return *sep++;
        }
    };


    std::locale l (std::cout.getloc (), (std::numpunct<char>*)new Punct);
    std::cout.imbue (l);

    std::cout << 123456789 << -123456789 << -123456789 << std::endl;

    return *std::use_facet<std::numpunct<char> >(std::cout.getloc ()).grouping (
).c_str ();
}

$ g++ t.cpp
$ ./a.out ; echo $?
123+456+78+9-123+456+78+9-123+456+78+9
2
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: libstdc++/5110: num_put caches num_punct values
@ 2002-03-03 11:16 rodrigc
  0 siblings, 0 replies; 5+ messages in thread
From: rodrigc @ 2002-03-03 11:16 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, sebor

Synopsis: num_put caches num_punct values

State-Changed-From-To: feedback->closed
State-Changed-By: rodrigc
State-Changed-When: Sun Mar  3 11:16:29 2002
State-Changed-Why:
    Output of gcc 3.0.4:
    123+456+78+9-123+456+78+9-123+456+78+9
    
    Output of 20020217 (experimental):
    123+456+78+9-1-234-567-89-/123/456/789

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5110


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

* Re: libstdc++/5110: num_put caches num_punct values
@ 2002-01-04 15:26 Martin Sebor
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Sebor @ 2002-01-04 15:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/5110; it has been noted by GNATS.

From: Martin Sebor <sebor@roguewave.com>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/5110: num_put caches num_punct values
Date: Fri, 04 Jan 2002 16:27:48 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5110
 
 It turns out that the caching of values returned from facet virtuals
 is not only meant to be allowed, but it was even specifically intended
 when locale was designed. I will be submitting an issue to clarify the
 standard to that effect. The opinion of the rest of the LWG is that
 behavior of the test case should be unspecified.
 
 Thanks
 Martin


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

* Re: libstdc++/5110: num_put caches num_punct values
@ 2001-12-13 23:56 paolo
  0 siblings, 0 replies; 5+ messages in thread
From: paolo @ 2001-12-13 23:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR libstdc++/5110; it has been noted by GNATS.

From: paolo@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
  nobody@gcc.gnu.org, sebor@roguewave.com
Cc:  
Subject: Re: libstdc++/5110: num_put caches num_punct values
Date: 14 Dec 2001 07:46:30 -0000

 Synopsis: num_put caches num_punct values
 
 State-Changed-From-To: open->feedback
 State-Changed-By: paolo
 State-Changed-When: Thu Dec 13 23:46:29 2001
 State-Changed-Why:
     The problem is confirmed in the branch (3.0.2), but I
     cannot reproduce it with current 3.1 experimental snapshots.
     
     paolo:~> g++ sebor.cc
     paolo:~> a.out
     123+456+78+9-1-234-567-89-/123/456/789
     paolo:~> g++ --verbose
     Reading specs from /usr/local/gcc-temp/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
     Configured with: ../Sandbox2/gcc/configure --prefix=/usr/local/gcc-temp --enable-languages=c,c++
     Thread model: single
     gcc version 3.1 20011212 (experimental)
     
     Could you perhaps test one of those?
     
     Thanks,
     Paolo.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5110&database=gcc


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

* Re: libstdc++/5110: num_put caches num_punct values
@ 2001-12-13 23:46 paolo
  0 siblings, 0 replies; 5+ messages in thread
From: paolo @ 2001-12-13 23:46 UTC (permalink / raw)
  To: gcc-bugs, gcc-gnats, gcc-prs, nobody, sebor

Synopsis: num_put caches num_punct values

State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Thu Dec 13 23:46:29 2001
State-Changed-Why:
    The problem is confirmed in the branch (3.0.2), but I
    cannot reproduce it with current 3.1 experimental snapshots.
    
    paolo:~> g++ sebor.cc
    paolo:~> a.out
    123+456+78+9-1-234-567-89-/123/456/789
    paolo:~> g++ --verbose
    Reading specs from /usr/local/gcc-temp/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
    Configured with: ../Sandbox2/gcc/configure --prefix=/usr/local/gcc-temp --enable-languages=c,c++
    Thread model: single
    gcc version 3.1 20011212 (experimental)
    
    Could you perhaps test one of those?
    
    Thanks,
    Paolo.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5110&database=gcc


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

end of thread, other threads:[~2002-03-03 19:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-13 18:56 libstdc++/5110: num_put caches num_punct values sebor
2001-12-13 23:46 paolo
2001-12-13 23:56 paolo
2002-01-04 15:26 Martin Sebor
2002-03-03 11:16 rodrigc

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