public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong
@ 2003-11-11 10:34 peturr02 at ru dot is
2003-11-11 10:35 ` [Bug libstdc++/13007] " peturr02 at ru dot is
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: peturr02 at ru dot is @ 2003-11-11 10:34 UTC (permalink / raw)
To: gcc-bugs
Currently, basic_streambuf::pubimbue does not modify _M_buf_locale, but
basic_streambuf::imbue does so. This appears wrong.
* The effects clause of imbue says "Does nothing"
* The postcondition clause of pubimbue(loc) is "loc == getloc()". There is
no mention that derived classes need to call basic_streambuf::imbue()
from overridden versions for this to hold.
* The returns clause of getloc() says that if getloc() is called from
an overridden version of imbue, then getloc() will return the previously
imbued locale. There is no mention that this does not hold if
basic_streambuf::imbue is called from the derived class version.
--
Summary: basic_streambuf::pubimbue, imbue wrong
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peturr02 at ru dot is
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
@ 2003-11-11 10:35 ` peturr02 at ru dot is
2003-11-11 13:22 ` paolo at gcc dot gnu dot org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: peturr02 at ru dot is @ 2003-11-11 10:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From peturr02 at ru dot is 2003-11-11 10:35 -------
Created an attachment (id=5113)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5113&action=view)
Test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
2003-11-11 10:35 ` [Bug libstdc++/13007] " peturr02 at ru dot is
@ 2003-11-11 13:22 ` paolo at gcc dot gnu dot org
2003-11-11 13:23 ` paolo at gcc dot gnu dot org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-11-11 13:22 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paolo at gcc dot gnu dot org 2003-11-11 13:22 -------
Created an attachment (id=5114)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5114&action=view)
Draft patch (without new testsuite entry)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
2003-11-11 10:35 ` [Bug libstdc++/13007] " peturr02 at ru dot is
2003-11-11 13:22 ` paolo at gcc dot gnu dot org
@ 2003-11-11 13:23 ` paolo at gcc dot gnu dot org
2003-11-12 8:09 ` peturr02 at ru dot is
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-11-11 13:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paolo at gcc dot gnu dot org 2003-11-11 13:23 -------
Hi, thanks for the PR and the detailed testcase (will be properly acknowledged!)
Could you please have a look to the attached draft patch?
(Passes testsuite + imbuebug4.cc of course)
Thanks,
Paolo.
--
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-11-11 13:23:57
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (2 preceding siblings ...)
2003-11-11 13:23 ` paolo at gcc dot gnu dot org
@ 2003-11-12 8:09 ` peturr02 at ru dot is
2003-11-12 9:44 ` paolo at gcc dot gnu dot org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: peturr02 at ru dot is @ 2003-11-12 8:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From peturr02 at ru dot is 2003-11-12 08:09 -------
This bit is wrong:
{
locale __tmp(this->getloc());
this->imbue(__loc);
+ if (__tmp != __loc)
+ _M_buf_locale = __loc;
return __tmp;
}
Consider an implementation of imbue that caches a facet:
class Foo : public streambuf {
ctype<char>* ct;
void imbue(const locale& loc) {
ct = &use_facet<ctype<char> >(loc);
}
};
This is then called like this:
Foo foo;
foo.pubimbue(locale("is_IS"));
foo.pubimbue(locale("is_IS"));
In the first call to pubimbue the locale is set correctly and all is well.
In the second call the temporary object is passed to imbue and a reference
to the facet stored, but streambuf does not store a copy of the temporary
and so the cached facet becomes a dangling pointer.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (3 preceding siblings ...)
2003-11-12 8:09 ` peturr02 at ru dot is
@ 2003-11-12 9:44 ` paolo at gcc dot gnu dot org
2003-11-13 23:13 ` cvs-commit at gcc dot gnu dot org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-11-12 9:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paolo at gcc dot gnu dot org 2003-11-12 09:44 -------
I see... Will change those two lines with a plain "_M_buf_locale = __loc;"
Thanks!
Paolo.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (4 preceding siblings ...)
2003-11-12 9:44 ` paolo at gcc dot gnu dot org
@ 2003-11-13 23:13 ` cvs-commit at gcc dot gnu dot org
2003-11-13 23:16 ` paolo at gcc dot gnu dot org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-11-13 23:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2003-11-13 23:13 -------
Subject: Bug 13007
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2003-11-13 23:13:22
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: fstream.tcc
libstdc++-v3/include/std: std_streambuf.h
libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char: 2.cc
libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t: 2.cc
Added files:
libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char: 13007.cc
libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t:
13007.cc
libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char:
13007-1.cc
13007-2.cc
libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/wchar_t:
13007-1.cc
13007-2.cc
Log message:
2003-11-13 Paolo Carlini <pcarlini@suse.de>
Petur Runolfsson <peturr02@ru.is>
PR libstdc++/13007
* include/bits/fstream.tcc (imbue): Don't touch the stored
locale.
* include/std/std_streambuf.h (imbue): According to the
standard, base class version does nothing.
(pubimbue): Store the locale.
* testsuite/27_io/basic_filebuf/imbue/char/13007.cc: New.
* testsuite/27_io/basic_filebuf/imbue/wchar_t/13007.cc: New.
* testsuite/27_io/basic_filebuf/imbue/char/2.cc: Tweak.
* testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc: Likewise.
* testsuite/27_io/basic_streambuf/imbue/char/13007-1.cc: New.
* testsuite/27_io/basic_streambuf/imbue/char/13007-2.cc: New.
* testsuite/27_io/basic_streambuf/imbue/wchar_t/13007-1.cc: New.
* testsuite/27_io/basic_streambuf/imbue/wchar_t/13007-2.cc: New.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2082&r2=1.2083
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/fstream.tcc.diff?cvsroot=gcc&r1=1.106&r2=1.107
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/std/std_streambuf.h.diff?cvsroot=gcc&r1=1.44&r2=1.45
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/13007.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/char/2.cc.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/13007.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/wchar_t/2.cc.diff?cvsroot=gcc&r1=1.3&r2=1.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/13007-1.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/char/13007-2.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/wchar_t/13007-1.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_streambuf/imbue/wchar_t/13007-2.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (5 preceding siblings ...)
2003-11-13 23:13 ` cvs-commit at gcc dot gnu dot org
@ 2003-11-13 23:16 ` paolo at gcc dot gnu dot org
2003-12-19 21:14 ` bkoz at gcc dot gnu dot org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-11-13 23:16 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paolo at gcc dot gnu dot org 2003-11-13 23:16 -------
Fixed for 3.4.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |3.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (6 preceding siblings ...)
2003-11-13 23:16 ` paolo at gcc dot gnu dot org
@ 2003-12-19 21:14 ` bkoz at gcc dot gnu dot org
2004-01-07 11:57 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: bkoz at gcc dot gnu dot org @ 2003-12-19 21:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at gcc dot gnu dot org 2003-12-19 20:33 -------
Yo folks, we should move this patch to the gcc-3_3-branch. Thoughts?
-benjamin
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (7 preceding siblings ...)
2003-12-19 21:14 ` bkoz at gcc dot gnu dot org
@ 2004-01-07 11:57 ` cvs-commit at gcc dot gnu dot org
2004-01-07 11:58 ` paolo at gcc dot gnu dot org
2004-01-07 16:13 ` bkoz at redhat dot com
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-01-07 11:57 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-01-07 11:57 -------
Subject: Bug 13007
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_3-branch
Changes by: paolo@gcc.gnu.org 2004-01-07 11:57:36
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: fstream.tcc
libstdc++-v3/include/std: std_streambuf.h
Log message:
2004-01-07 Paolo Carlini <pcarlini@suse.de>
Petur Runolfsson <peturr02@ru.is>
PR libstdc++/13007
* include/bits/fstream.tcc (imbue): Don't touch the stored
locale.
* include/std/std_streambuf.h (imbue): According to the
standard, base class version does nothing.
(pubimbue): Store the locale.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.161&r2=1.1464.2.162
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/fstream.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.42.2.13&r2=1.42.2.14
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/std/std_streambuf.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.11.2.2&r2=1.11.2.3
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (8 preceding siblings ...)
2004-01-07 11:57 ` cvs-commit at gcc dot gnu dot org
@ 2004-01-07 11:58 ` paolo at gcc dot gnu dot org
2004-01-07 16:13 ` bkoz at redhat dot com
10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu dot org @ 2004-01-07 11:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From paolo at gcc dot gnu dot org 2004-01-07 11:58 -------
Fixed for 3.3.3 too!
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bkoz at redhat dot com
Target Milestone|3.4.0 |3.3.3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/13007] basic_streambuf::pubimbue, imbue wrong
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
` (9 preceding siblings ...)
2004-01-07 11:58 ` paolo at gcc dot gnu dot org
@ 2004-01-07 16:13 ` bkoz at redhat dot com
10 siblings, 0 replies; 12+ messages in thread
From: bkoz at redhat dot com @ 2004-01-07 16:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bkoz at redhat dot com 2004-01-07 16:13 -------
Subject: Re: basic_streambuf::pubimbue, imbue wrong
>Fixed for 3.3.3 too!
Thanks Paolo!
-benjamin
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13007
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2004-01-07 16:13 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-11 10:34 [Bug libstdc++/13007] New: basic_streambuf::pubimbue, imbue wrong peturr02 at ru dot is
2003-11-11 10:35 ` [Bug libstdc++/13007] " peturr02 at ru dot is
2003-11-11 13:22 ` paolo at gcc dot gnu dot org
2003-11-11 13:23 ` paolo at gcc dot gnu dot org
2003-11-12 8:09 ` peturr02 at ru dot is
2003-11-12 9:44 ` paolo at gcc dot gnu dot org
2003-11-13 23:13 ` cvs-commit at gcc dot gnu dot org
2003-11-13 23:16 ` paolo at gcc dot gnu dot org
2003-12-19 21:14 ` bkoz at gcc dot gnu dot org
2004-01-07 11:57 ` cvs-commit at gcc dot gnu dot org
2004-01-07 11:58 ` paolo at gcc dot gnu dot org
2004-01-07 16:13 ` bkoz at redhat dot com
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).