public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/106248] [11/12/13 Regression] operator>>std::basic_istream at boundary condition behave differently in different opt levels Date: Mon, 11 Jul 2022 11:46:50 +0000 [thread overview] Message-ID: <bug-106248-4-STXmMjDQfc@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106248-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106248 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- I think this would restore the previous behaviour without losing the overflow prevention: --- a/libstdc++-v3/include/std/istream +++ b/libstdc++-v3/include/std/istream @@ -813,8 +813,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION else { if (__n == (size_t)-1) - __n = __gnu_cxx::__numeric_traits<streamsize>::__max; - std::__istream_extract(__in, __s, __n / sizeof(_CharT)); + { + __n = __gnu_cxx::__numeric_traits<streamsize>::__max; + std::__istream_extract(__in, __s, __n / sizeof(_CharT)); + } + else + { + std::__istream_extract(__in, __s, __n / sizeof(_CharT)); + if (__in.good() && _Traits::eq_int_type(__in.rdbuf()->snextc(), + _Traits::eof())) + __in.setstate(ios_base::eofbit); + } } return __in; }
next prev parent reply other threads:[~2022-07-11 11:46 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-11 1:39 [Bug libstdc++/106248] New: " Ting.Wang.SH at ibm dot com 2022-07-11 6:11 ` [Bug libstdc++/106248] " pinskia at gcc dot gnu.org 2022-07-11 11:07 ` redi at gcc dot gnu.org 2022-07-11 11:20 ` [Bug libstdc++/106248] [11/12/13 Regression] " redi at gcc dot gnu.org 2022-07-11 11:34 ` redi at gcc dot gnu.org 2022-07-11 11:36 ` redi at gcc dot gnu.org 2022-07-11 11:46 ` redi at gcc dot gnu.org [this message] 2022-07-11 12:38 ` redi at gcc dot gnu.org 2022-07-11 13:32 ` redi at gcc dot gnu.org 2022-07-12 22:40 ` cvs-commit at gcc dot gnu.org 2022-07-12 22:41 ` [Bug libstdc++/106248] [11/12 " redi at gcc dot gnu.org 2022-07-25 15:05 ` rguenth at gcc dot gnu.org 2022-08-03 13:47 ` cvs-commit at gcc dot gnu.org 2022-08-03 13:48 ` [Bug libstdc++/106248] [11 " redi at gcc dot gnu.org 2022-09-07 17:49 ` cvs-commit at gcc dot gnu.org 2022-09-07 17:53 ` redi at gcc dot gnu.org
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=bug-106248-4-STXmMjDQfc@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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).