public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: lennox@cs.columbia.edu To: gcc-gnats@gcc.gnu.org Subject: libstdc++/8127: cout << cin.rdbuf() causes infinite loop Date: Wed, 02 Oct 2002 13:56:00 -0000 [thread overview] Message-ID: <20021002205534.14886.qmail@sources.redhat.com> (raw) >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
next reply other threads:[~2002-10-02 20:56 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-10-02 13:56 lennox [this message] 2002-10-06 5:03 paolo 2002-11-25 9:15 paolo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021002205534.14886.qmail@sources.redhat.com \ --to=lennox@cs.columbia.edu \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).