If wcin.rdbuf()->sgetc() is called followed by wcin.rdbuf()->sbumpc(), the return value is not always the same, unless the charset in use happens to be ISO-8859-1. Reason: basic_filebuf<wchar_t>::_M_underflow_common returns wide characters to the FILE* using ungetc. This happens to work if the charset is ISO-8859-1 (because the values are the same as in UCS-4), but breaks for all other single-byte charsets. Note that there is an even more serious bug here when dealing with multibyte charsets: in general a single wide character can have been converted from more than one narrow character. This is however shadowed by other problems in _M_underflow_common. Release: gcc-3.2.1 Environment: Red Hat Linux 8.0 How-To-Repeat: See attachment.
*** This bug has been marked as a duplicate of 9520 ***
From: =?iso-8859-1?Q?P=E9tur_Run=F3lfsson?= <peturr02@ru.is> To: <paolo@gcc.gnu.org>, <gcc-bugs@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>, <nobody@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org> Cc: Subject: RE: libstdc++/9521: Garbled input from wcin Date: Fri, 31 Jan 2003 13:30:59 -0000 > Synopsis: Garbled input from wcin >=20 > State-Changed-From-To: open->closed > State-Changed-By: paolo > State-Changed-When: Fri Jan 31 13:28:55 2003 > State-Changed-Why: > Exact duplicate of libstdc++/9520. >=20 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=3Dview%20audit-trail& database=3Dgcc&pr=3D9521 Yup, sorry about that. Must have hit submit twice :-( Petur