From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13058 invoked by alias); 18 Apr 2002 15:06:07 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 13003 invoked by uid 71); 18 Apr 2002 15:06:02 -0000 Resent-Date: 18 Apr 2002 15:06:02 -0000 Resent-Message-ID: <20020418150602.13002.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, mki@maconomy.dk Received:(qmail 9456 invoked by uid 61); 18 Apr 2002 14:57:56 -0000 Message-Id:<20020418145756.9452.qmail@sources.redhat.com> Date: Thu, 18 Apr 2002 08:06:00 -0000 From: mki@maconomy.dk Reply-To: mki@maconomy.dk To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/6360: Wrong workaround in char_traits.h - ignore stops on \0xff X-SW-Source: 2002-04/txt/msg00933.txt.bz2 List-Id: >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(static_cast(__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: