From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24170 invoked by alias); 5 Nov 2002 23:06:02 -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 24143 invoked by uid 71); 5 Nov 2002 23:06:01 -0000 Resent-Date: 5 Nov 2002 23:06:01 -0000 Resent-Message-ID: <20021105230601.24142.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, james@preston.net Received: (qmail 16734 invoked by uid 61); 5 Nov 2002 22:56:27 -0000 Message-Id: <20021105225627.16733.qmail@sources.redhat.com> Date: Tue, 05 Nov 2002 15:06:00 -0000 From: james@preston.net Reply-To: james@preston.net To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: libstdc++/8470: istream::get does not handle empty lines correctly X-SW-Source: 2002-11/txt/msg00254.txt.bz2 List-Id: >Number: 8470 >Category: libstdc++ >Synopsis: istream::get does not handle empty lines correctly >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Nov 05 15:06:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: James Oliver >Release: gcc v 3.x >Organization: >Environment: Linux and Solaris tested with default builds of gcc 3.1, 3.1.1, and 3.2 >Description: I am trying to work on a problem that I am experiencing with gcc 3.2. Essentially I think there is a problem with the "istream::get(Ch* P, streamsize N, Ch term)" routine in that it does not deal with empty lines on the input stream. The attached program demonstrates the problem. The command line to compile used was: /scratch/test/gcc/gcc32id/bin/gcc -static -o streamBug streamBug.C -lstdc++ >How-To-Repeat: With the following input file (between the === lines) as stdin for the program: === 1234567890 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 1234567890 === I only get the first 2 lines back, and when I perform the get on the empty line the stream good bit is no longer set. This behaviour does not occurr under the gcc 2.95.3 supplied libraries/compiler so I suspect a problem with gcc 3.x (I have tried it wth 3.1, and 3.2). >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="streamBug.C" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="streamBug.C" I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKLy8jZGVmaW5lIERFQlVH Cgpib29sCnN0cmVhbU9LKGNvbnN0IGlzdHJlYW0mIHN0cmVhbSkKewojaWZkZWYgREVCVUcKICAg IGNvdXQgPDwgInN0cmVhbS5lb2YoKSA6OiAiIDw8IHN0cmVhbS5lb2YoKSA8PCBlbmRsOwogICAg Y291dCA8PCAic3RyZWFtLmdvb2QoKSA6OiAiIDw8IHN0cmVhbS5nb29kKCkgPDwgZW5kbDsKI2Vu ZGlmCiAgICByZXR1cm4gIXN0cmVhbS5lb2YoKSAmJiBzdHJlYW0uZ29vZCgpOwp9CgpuYW1lc3Bh Y2UKewogICAgY29uc3QgaW50IGJ1ZkxlbiA9IDEwOwp9OwoKaW50IG1haW4oKQp7CiAgICBjaGFy IGJ1ZltidWZMZW5dOwoKICAgIHdoaWxlKHN0cmVhbU9LKGNpbikpCiAgICB7CiAgICAgICAgYnVm WzBdID0gJ1wwJzsKCiAgICAgICAgLy8gUmVhZCBidWYgY2hhcmFjdGVycyBhdCBhIHRpbWUsIGFu ZCBvdXRwdXQKICAgICAgICAvLyB0byBzdGRvdXQuCiAgICAgICAgY2luLmdldChidWYsIGJ1Zkxl bik7CiAgICAgICAgY291dCA8PCBidWY7CgogICAgICAgIGlmKHN0cmVhbU9LKGNpbikgJiYgY2lu Lmdjb3VudCgpIDwgYnVmTGVuIC0gMSkKICAgICAgICB7CiAgICAgICAgICAgIC8vIENob21wIHRo ZSBlbmQgb2YgbGluZSBjaGFyYWN0ZXIuCiAgICAgICAgICAgIGNpbi5nZXQoKTsKICAgICAgICAg ICAgY291dCA8PCBlbmRsOwogICAgICAgIH0KfQoKcmV0dXJuIDA7Cn0K