https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110462
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2023-06-28 Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Target Milestone|--- |14.0 Ever confirmed|0 |1 --- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Sam James from comment #3) > Looks like we already AC_SYS_LARGEFILE in libstdc++-v3/configure.ac, so this > should be as simple as just using off_t instead? Ah but the filesystem sources include <bits/largefile-config.h> which means off_t is 64-bit here. I'll test this: diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index efc27aa493e..43dd80abc15 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -5160,7 +5160,7 @@ dnl linux*) GCC_TRY_COMPILE_OR_LINK( [#include <unistd.h>], - [copy_file_range(1, nullptr, 2, nullptr, 1, 0);], + [copy_file_range(1, (off_t*)nullptr, 2, (off_t*)nullptr, 1, 0);], [glibcxx_cv_copy_file_range=yes], [glibcxx_cv_copy_file_range=no]) ;; diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h index f04bbc66d7d..e04cb4010d7 100644 --- a/libstdc++-v3/src/filesystem/ops-common.h +++ b/libstdc++-v3/src/filesystem/ops-common.h @@ -374,7 +374,9 @@ _GLIBCXX_BEGIN_NAMESPACE_FILESYSTEM return false; } size_t bytes_left = length; - off64_t off_in = 0, off_out = 0; + // copy_file_range wants off64_t* args, but libc might only define off_t. + static_assert(sizeof(off_t) == sizeof(int64_t), "off_t is 64-bit"); + off_t off_in = 0, off_out = 0; ssize_t bytes_copied; do {