public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/8127: cout << cin.rdbuf() causes infinite loop
@ 2002-10-06  5:03 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2002-10-06  5:03 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, lennox, nobody

Synopsis: cout << cin.rdbuf() causes infinite loop

State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sun Oct  6 05:03:04 2002
State-Changed-Why:
    Confirmed. This is actually a duplicate of c++/6745, but I'm
    not closing it since some additional information is provided.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8127


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/8127: cout << cin.rdbuf() causes infinite loop
@ 2002-11-25  9:15 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2002-11-25  9:15 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, lennox, nobody

Synopsis: cout << cin.rdbuf() causes infinite loop

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Tue Nov 19 01:36:29 2002
State-Changed-Why:
    I'm closing it: by now we understand those issues, which are
    fixed as far as correctness in concerned.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8127


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/8127: cout << cin.rdbuf() causes infinite loop
@ 2002-10-02 13:56 lennox
  0 siblings, 0 replies; 3+ messages in thread
From: lennox @ 2002-10-02 13:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8127
>Category:       libstdc++
>Synopsis:       cout << cin.rdbuf() causes infinite loop
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 02 13:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     lennox@cs.columbia.edu
>Release:        gcc-3.1
>Organization:
>Environment:
sparc-sun-solaris2.8
>Description:
The attached trivial implementation of 'cat' goes into an infinite loop when compiled with GCC 3.1.

This may be another instance of bug libstdc++/8071, interacting with libstdc++/7744.  However, it seems to me that this is a much more significant example of the bug.

The problem arises in basic_streambuf::__copy_streambufs.
This function calls __sbout->in_avail() to get the number of characters that it can read.  If this returns 0, the function loops forever calling  __sbout->sputn(__sbin->gptr(), 0).

This is a regression from gcc 2.95.2, which executes this code correctly.

(I haven't tested this code with GCC 3.3 mainline, but I don't see anything in GNATS or viewcvs which would indicate that this code has changed since 3.1.)
>How-To-Repeat:
Compile the attached program, and run it with standard input coming from somewhere.  E.g.:

grandcentral $ g++-2.95.2 -Wall -g -O2  -o test-rdbuf test-rdbuf.cxx
grandcentral $ ./test-rdbuf < /etc/nodename 
grandcentral.cs.columbia.edu
grandcentral $ g++ -Wall -g -O2  -o test-rdbuf test-rdbuf.cxx
grandcentral $ ./test-rdbuf < /etc/nodename 
^C
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test-rdbuf.cxx"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test-rdbuf.cxx"

I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewog
IGNvdXQgPDwgY2luLnJkYnVmKCk7Cn0K


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-11-19  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-06  5:03 libstdc++/8127: cout << cin.rdbuf() causes infinite loop paolo
  -- strict thread matches above, loose matches on Subject: below --
2002-11-25  9:15 paolo
2002-10-02 13:56 lennox

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).