[Bug libstdc++/91947] std::filesystem::file_size will return wrong value on 32bit platforms with large files support
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 26 13:10:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91947
--- Comment #20 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:56b6c2ba3a45c768a33f726b130a56fc19cca650
commit r8-10084-g56b6c2ba3a45c768a33f726b130a56fc19cca650
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Jan 9 13:38:43 2020 +0000
Build filesystem library with large file support
Enable AC_SYS_LARGEFILE to set the macros needed for large file APIs to
be used by default. We do not want to define those macros in the
public headers that users include. The values of the macros are copied
to a separate file that is only included by the filesystem sources
during the build, and then the macros in <bits/c++config.h> are renamed
so that they don't have any effect in user code including our headers.
Also use larger type for result of filesystem::file_size to avoid
truncation of large values on 32-bit systems (PR 91947).
Backport from mainlne
2019-10-04 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/81091
PR libstdc++/91947
* configure.ac: Use AC_SYS_LARGEFILE to enable 64-bit file APIs.
* config.h.in: Regenerate:
* configure: Regenerate:
* include/Makefile.am (${host_builddir}/largefile-config.h): New
target to generate config header for filesystem library.
(${host_builddir}/c++config.h): Rename macros for large file support.
* include/Makefile.in: Regenerate.
* src/c++17/fs_dir.cc: Include new config header.
* src/c++17/fs_ops.cc: Likewise.
(filesystem::file_size): Use uintmax_t for size.
* src/filesystem/dir.cc: Include new config header.
* src/filesystem/ops.cc: Likewise.
(experimental::filesystem::file_size): Use uintmax_t for size.
More information about the Gcc-bugs
mailing list