From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14158 invoked by alias); 18 Jan 2002 12:56:03 -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 14123 invoked by uid 71); 18 Jan 2002 12:56:02 -0000 Resent-Date: 18 Jan 2002 12:56:02 -0000 Resent-Message-ID: <20020118125602.14122.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, Rainer Doerntge Received:(qmail 8849 invoked from network); 18 Jan 2002 12:47:32 -0000 Received: from unknown (HELO localhost.localdomain) (212.105.201.68) by sources.redhat.com with SMTP; 18 Jan 2002 12:47:32 -0000 Received: (from rainer@localhost) by localhost.localdomain (8.11.6/8.11.6) id g0IClUf31683; Fri, 18 Jan 2002 13:47:30 +0100 Message-Id:<200201181247.g0IClUf31683@localhost.localdomain> Date: Fri, 18 Jan 2002 04:56:00 -0000 From: Rainer Doerntge To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: libstdc++/5424: ifstream::operator>>(int&) malfunction X-SW-Source: 2002-01/txt/msg00653.txt.bz2 List-Id: >Number: 5424 >Category: libstdc++ >Synopsis: std::ifstream::operator>>(int&) fails with negative hex numbers >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Jan 18 04:56:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: >Release: 3.0.3 >Organization: Kiwilogic.com AG >Environment: System: Linux klservedv 2.4.9-13smp #1 SMP Tue Oct 30 19:57:16 EST 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../configure --enable-exceptions --enable-threads >Description: Any negative int written to a file with std::ofstream::operator<<(int const&) and std::ios::hex as basefield is written in the complementary notation (-1 becomes ffffffff). When std::ifstream::operator>>(int&) tries to read that number again, the failbit gets set. This work finely under g++ < v3, Sun Forte C++, Borland's BCB5 and others. >How-To-Repeat: Write -1 to an ofstream in hex basefield mode and try to read it in again in hex basefield mode using std::ifstream >Fix: Read the number as string and convert it afterwards using e. g. atoi. >Release-Note: >Audit-Trail: >Unformatted: