public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/110574] New: --enable-cstdio=stdio_pure is incompatible with LFS
@ 2023-07-06 15:11 redi at gcc dot gnu.org
  2023-07-06 15:28 ` [Bug libstdc++/110574] " cvs-commit at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2023-07-06 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110574
           Summary: --enable-cstdio=stdio_pure is incompatible with LFS
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: keithp at keithp dot com
  Target Milestone: ---

Using --enable-cstdio=stdio_pure on x86_64-pc-linux-gnu results in test
failures:

FAIL: 27_io/basic_filebuf/imbue/char/13171-2.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/12790-3.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/45628-2.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/1-in.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/1-io.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/1-out.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/2-in.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/2-io.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/2-out.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/26777.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/char/4.cc execution test
FAIL: 27_io/basic_filebuf/seekoff/wchar_t/4.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/12790-2.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/12790-3.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/char/1-in.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/char/1-io.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/char/1-out.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/char/2-in.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/char/2-io.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/char/2-out.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/wchar_t/9874.cc execution test
FAIL: 27_io/basic_filebuf/seekpos/wchar_t/9875_seekpos.cc execution test
FAIL: 27_io/basic_filebuf/sgetn/char/2-in.cc execution test
FAIL: 27_io/basic_filebuf/sgetn/char/2-io.cc execution test
FAIL: 27_io/basic_filebuf/sputbackc/char/1-io.cc execution test
FAIL: 27_io/basic_filebuf/sputbackc/char/2-io.cc execution test
FAIL: 27_io/basic_filebuf/sungetc/char/1-io.cc execution test
FAIL: 27_io/basic_filebuf/sungetc/char/2-io.cc execution test
FAIL: 27_io/basic_filebuf/underflow/char/10097.cc execution test
FAIL: 27_io/basic_filebuf/underflow/wchar_t/5.cc execution test
FAIL: 27_io/basic_fstream/53984.cc execution test
FAIL: 27_io/basic_istream/peek/char/6414.cc execution test
FAIL: 27_io/basic_istream/peek/wchar_t/6414.cc execution test
FAIL: 27_io/basic_istream/seekg/char/fstream.cc execution test
FAIL: 27_io/basic_istream/seekg/wchar_t/fstream.cc execution test
FAIL: 27_io/basic_istream/tellg/char/fstream.cc execution test
FAIL: 27_io/basic_istream/tellg/wchar_t/fstream.cc execution test
FAIL: 27_io/objects/wchar_t/12.cc execution test

This seems to be because of code like:

  streamoff
  __basic_file<char>::seekoff(streamoff __off, ios_base::seekdir __way) throw
()
  {
#ifdef _GLIBCXX_USE_LFS
    return lseek64(this->fd(), __off, __way);
#else
    if (__off > numeric_limits<off_t>::max()
        || __off < numeric_limits<off_t>::min())
      return -1L;
#ifdef _GLIBCXX_USE_STDIO_PURE
    return fseek(this->file(), __off, __way);
#else
    return lseek(this->fd(), __off, __way);
#endif
#endif

If LFS is being used then the STDIO_PURE config is ignored, and we use lseek64
on the file descriptor unconditionally. Then when we read we do respect the
STDIO_PURE config:

  streamsize
  __basic_file<char>::xsgetn(char* __s, streamsize __n)
  {
    streamsize __ret;
    do
#ifdef _GLIBCXX_USE_STDIO_PURE
      __ret = fread(__s, 1, __n, this->file());
#else
      __ret = read(this->fd(), __s, __n);
#endif
    while (__ret == -1L && errno == EINTR);
    return __ret;
  }

But now we're seeking on the file descriptor and reading from the FILE. We need
to use fseek before fread.

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

end of thread, other threads:[~2023-07-18 11:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 15:11 [Bug libstdc++/110574] New: --enable-cstdio=stdio_pure is incompatible with LFS redi at gcc dot gnu.org
2023-07-06 15:28 ` [Bug libstdc++/110574] " cvs-commit at gcc dot gnu.org
2023-07-06 15:38 ` redi at gcc dot gnu.org
2023-07-06 16:24 ` redi at gcc dot gnu.org
2023-07-06 18:01 ` redi at gcc dot gnu.org
2023-07-07  5:54 ` keithp at keithp dot com
2023-07-12 20:04 ` cvs-commit at gcc dot gnu.org
2023-07-18 11:00 ` cvs-commit at gcc dot gnu.org

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