public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* RE: libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff
@ 2002-04-18 8:26 Mads
0 siblings, 0 replies; 4+ messages in thread
From: Mads @ 2002-04-18 8:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/6360; it has been noted by GNATS.
From: "Mads" <mki@maconomy.dk>
To: <gcc-gnats@gcc.gnu.org>,
<nobody@gcc.gnu.org>
Cc:
Subject: RE: libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff
Date: Thu, 18 Apr 2002 17:23:33 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_0004_01C1E6FE.6E0DE2D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
I tried to attach the attached file to the bugreport - but failed.
Can it be submitted this way?
/Mads
> -----Original Message-----
> From: gcc-gnats@gcc.gnu.org [mailto:gcc-gnats@gcc.gnu.org]
> Sent: Thursday, April 18, 2002 5:06 PM
> To: mki@maconomy.dk
> Subject: Re: libstdc++/6360: Wrong workaround in
> char_traits.h - ignore
> stops on \0xff
>
>
> Thank you very much for your problem report.
> It has the internal identification `libstdc++/6360'.
> The individual assigned to look at your
> report is: unassigned.
>
> >Category: libstdc++
> >Responsible: unassigned
> >Synopsis: Wrong workaround in char_traits.h - ignore
> stops on \0xff
> >Arrival-Date: Thu Apr 18 08:06:00 PDT 2002
>
------=_NextPart_000_0004_01C1E6FE.6E0DE2D0
Content-Type: application/octet-stream;
name="IstreamIgnore.cpp"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="IstreamIgnore.cpp"
#include <iostream>=0A=
#include <sstream>=0A=
=0A=
using namespace std;=0A=
=0A=
int main()=0A=
{=0A=
stringstream ss("abcd" "\xFF" "1234abcd");=0A=
=0A=
char c;=0A=
ss >> c;=0A=
cout << "1st char is: " << c << endl;=0A=
=0A=
cout << "Skipping 8 chars (i.e. until after the digits)..." << endl;=0A=
ss.ignore(8);=0A=
=0A=
cout << "The rest of the stream contains: '" << ss.rdbuf() << '\'' << =
endl;=0A=
=0A=
return 0;=0A=
}=0A=
------=_NextPart_000_0004_01C1E6FE.6E0DE2D0--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff
@ 2002-04-22 13:31 bkoz
0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2002-04-22 13:31 UTC (permalink / raw)
To: bkoz, gcc-bugs, gcc-prs, mki, nobody
Synopsis: Wrong workaround in char_traits.h - ignore stops on \0xff
Responsible-Changed-From-To: unassigned->bkoz
Responsible-Changed-By: bkoz
Responsible-Changed-When: Mon Apr 22 13:31:19 2002
Responsible-Changed-Why:
Mine.
State-Changed-From-To: analyzed->closed
State-Changed-By: bkoz
State-Changed-When: Mon Apr 22 13:31:19 2002
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6360
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff
@ 2002-04-19 12:28 bkoz
0 siblings, 0 replies; 4+ messages in thread
From: bkoz @ 2002-04-19 12:28 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, mki, nobody
Synopsis: Wrong workaround in char_traits.h - ignore stops on \0xff
State-Changed-From-To: open->analyzed
State-Changed-By: bkoz
State-Changed-When: Fri Apr 19 12:28:52 2002
State-Changed-Why:
confirmed on 3.1, 3.2 sources
// 2002-04-19 PR libstdc++ 6360
#include <sstream>
using namespace std;
int main()
{
bool test = true;
stringstream ss("abcd" "\xFF" "1234ina donna coolbrith");
char c;
ss >> c;
test &= c == 'a';
ss.ignore(8);
ss >> c;
test &= c == 'i';
return 0;
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6360
^ permalink raw reply [flat|nested] 4+ messages in thread
* libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff
@ 2002-04-18 8:06 mki
0 siblings, 0 replies; 4+ messages in thread
From: mki @ 2002-04-18 8:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 6360
>Category: libstdc++
>Synopsis: Wrong workaround in char_traits.h - ignore stops on \0xff
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 18 08:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Mads Kiilerich
>Release: 3.0.4
>Organization:
>Environment:
Seen on RedHat linux 6.2 - and on Solaris 2.7
>Description:
The default delimiter for Istream::ignore is EOF (-1).
Several places in include/g++-v3/bits/istream.tcc the following is found:
const int_type __idelim = traits_type::to_int_type(__delim);
calling the method in gcc/include/g++-v3/bits/char_traits.h:184 :
// To keep both the byte 0xff and the eof symbol 0xffffffff
// from ending up as 0xffffffff.
static int_type
to_int_type(const char_type& __c)
{ return static_cast<int_type>(static_cast<unsigned char>(__c)); }
- but then __idelim is set to 255, causing Istream::ignore to stop ignoring first time it meets a char value of 255.
In this case the delimiter should be -1, so that ignorance only stops when a real negative unsigned char is found - and that hardly happens...
>How-To-Repeat:
The following testcase is expected to do as it does when compiled with KAI:
[mk@linux-tools IstreamIgnore]$ ./IstreamIgnore.KCC
1st char is: a
Skipping 8 chars (i.e. until after the digits)...
The rest of the stream contains: 'abcd'
But using gcc 3.0.4 we get:
[mk@linux-tools IstreamIgnore]$ ./IstreamIgnore.gcc
1st char is: a
Skipping 8 chars (i.e. until after the digits)...
The rest of the stream contains: '1234abcd'
>Fix:
Idunno. But the current workaround does not seem good...
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-04-22 20:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-18 8:26 libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff Mads
-- strict thread matches above, loose matches on Subject: below --
2002-04-22 13:31 bkoz
2002-04-19 12:28 bkoz
2002-04-18 8:06 mki
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).