From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 80AE638560AA; Thu, 6 Jul 2023 15:12:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 80AE638560AA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688656320; bh=Al7nZlHLcefeicXcCbKw/uDh/n7QS4r8+wo3r2uvkh0=; h=From:To:Subject:Date:From; b=ENbwM9NC9SfSENOdSocHR244nTyqNcRrleP9idsgpK7H2cFhW+ghvivMmbzA94RGC IDAUX4mKSLNdMN3jUCYcuRkhxQsQFel1ZJMnicrcmxKc0paXVYzs+dFRRrud4V2YRt ahZV4VePyjDqGlhxot//uHGGyGHeM9WT/6yTkA2E= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110574] New: --enable-cstdio=stdio_pure is incompatible with LFS Date: Thu, 06 Jul 2023 15:11:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110574 Bug ID: 110574 Summary: --enable-cstdio=3Dstdio_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=3Dstdio_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::seekoff(streamoff __off, ios_base::seekdir __way) thr= ow () { #ifdef _GLIBCXX_USE_LFS return lseek64(this->fd(), __off, __way); #else if (__off > numeric_limits::max() || __off < numeric_limits::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 lsee= k64 on the file descriptor unconditionally. Then when we read we do respect the STDIO_PURE config: streamsize __basic_file::xsgetn(char* __s, streamsize __n) { streamsize __ret; do #ifdef _GLIBCXX_USE_STDIO_PURE __ret =3D fread(__s, 1, __n, this->file()); #else __ret =3D read(this->fd(), __s, __n); #endif while (__ret =3D=3D -1L && errno =3D=3D EINTR); return __ret; } But now we're seeking on the file descriptor and reading from the FILE. We = need to use fseek before fread.=