]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc
PR libstdc++/85632 fix wraparound in filesystem::space
authorJonathan Wakely <jwakely@redhat.com>
Thu, 3 May 2018 18:58:00 +0000 (19:58 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 3 May 2018 18:58:00 +0000 (19:58 +0100)
commit2e023647c8e5733305471da13cc5144e1cc3d42b
tree17215da3d46876570a25807283d69460939f54a6
parentd18734b5adea54ddd004e51b8d2593752133596c
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.

From-SVN: r259901
libstdc++-v3/ChangeLog
libstdc++-v3/src/filesystem/ops.cc
libstdc++-v3/src/filesystem/std-ops.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc
libstdc++-v3/testsuite/experimental/filesystem/operations/space.cc [new file with mode: 0644]