public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "lh_mouse at 126 dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/64064] basic_filebuf seekoff return value is unusable for files opened in text mode on Windows
Date: Fri, 19 Jan 2024 08:18:19 +0000	[thread overview]
Message-ID: <bug-64064-4-bVPVEiEa5b@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64064-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from LIU Hao <lh_mouse at 126 dot com> ---
It looks that MS STL calls `_fseeki64(fp, ...)` [1], while libstdc++ calls
`lseek(_fileno(fp), ...)` [2].

The seek operation shall take the buffering of `FILE` struct into account,
hence I think the libstdc++ implementation is incorrect.


[1]
https://github.com/microsoft/STL/blob/442029c6fa37f1b6f9203357de09672d5704077c/stl/inc/__msvc_filebuf.hpp#L624
[2]
https://github.com/gcc-mirror/gcc/blob/9693459e030977d6e906ea7eb587ed09ee4fddbd/libstdc%2B%2B-v3/config/io/basic_file_stdio.cc#L425

  parent reply	other threads:[~2024-01-19  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25  0:50 [Bug libstdc++/64064] New: " lukeallardyce at gmail dot com
2024-01-19  7:51 ` [Bug libstdc++/64064] " lh_mouse at 126 dot com
2024-01-19  8:18 ` lh_mouse at 126 dot com [this message]
2024-02-12 10:12 ` 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-64064-4-bVPVEiEa5b@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).