This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libstdc++/8470: istream::get does not handle empty lines correctly


>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]