public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenther at suse dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/98001] ext/stdio_filebuf/char/79820.cc is broken
Date: Thu, 26 Nov 2020 10:56:04 +0000	[thread overview]
Message-ID: <bug-98001-4-ZeNVyqYTKr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98001-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98001

--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 26 Nov 2020, redi at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98001
> 
> Jonathan Wakely <redi at gcc dot gnu.org> changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>            Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
>              Status|NEW                         |ASSIGNED
> 
> --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> I don't think we actually need fflush(__file) to set errno in order to verify
> that the library doesn't set it to zero.
> 
> So this should be fine:
> 
> --- a/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
> +++ b/libstdc++-v3/testsuite/ext/stdio_filebuf/char/79820.cc
> @@ -26,10 +26,10 @@ void
>  test01()
>  {
>    FILE* f = std::fopen("79820.txt", "w");
> -  std::fclose(f);
>    errno = 127;
>    __gnu_cxx::stdio_filebuf<char> b(f, std::ios::out, BUFSIZ);
>    VERIFY(errno == 127); // PR libstdc++/79820
> +  std::fclose(f);
>  }

Is the DTOR of stdio_filebuf fine with the file being closed
under it?  For a fix in our GCC 7 tree I wrapped it in
its own scope to ensure the DTOR is called before fclose

>  int
> 
>

  parent reply	other threads:[~2020-11-26 10:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  8:48 [Bug libstdc++/98001] New: " rguenth at gcc dot gnu.org
2020-11-26  9:00 ` [Bug libstdc++/98001] " jakub at gcc dot gnu.org
2020-11-26 10:10 ` redi at gcc dot gnu.org
2020-11-26 10:25 ` redi at gcc dot gnu.org
2020-11-26 10:56 ` rguenther at suse dot de [this message]
2020-11-26 11:24 ` redi at gcc dot gnu.org
2020-11-26 11:26 ` cvs-commit at gcc dot gnu.org
2020-11-26 11:28 ` redi at gcc dot gnu.org
2020-11-26 12:04 ` cvs-commit at gcc dot gnu.org
2020-11-26 12:05 ` cvs-commit at gcc dot gnu.org
2020-11-26 12:08 ` cvs-commit at gcc dot gnu.org
2020-11-26 12:08 ` 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-98001-4-ZeNVyqYTKr@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: link
Be 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).