[Bug libstdc++/85632] std::filesystem::space or std::experimental::filesystem::space does not return correct information

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 3 18:58:00 GMT 2018


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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu May  3 18:58:00 2018
New Revision: 259901

URL: https://gcc.gnu.org/viewcvs?rev=259901&root=gcc&view=rev
Log:
PR libstdc++/85632 fix wraparound in filesystem::space

On 32-bit targets any values over 4GB would wrap and produce the wrong
result.

        PR libstdc++/85632 use uintmax_t for arithmetic
        * src/filesystem/ops.cc (experimental::filesystem::space): Perform
        arithmetic in result type.
        * src/filesystem/std-ops.cc (filesystem::space): Likewise.
        * testsuite/27_io/filesystem/operations/space.cc: Check total capacity
        is greater than free space.
        * testsuite/experimental/filesystem/operations/space.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
      - copied, changed from r259900,
trunk/libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/src/filesystem/ops.cc
    trunk/libstdc++-v3/src/filesystem/std-ops.cc
    trunk/libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc


More information about the Gcc-bugs mailing list