PR libstdc++/85632 fix wraparound in filesystem::space
commit658e7fd008724d8316bf824dd344b8410c376b50
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 May 2018 18:58:00 +0000 (3 18:58 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 May 2018 18:58:00 +0000 (3 18:58 +0000)
tree17215da3d46876570a25807283d69460939f54a6
parent331b2b6d79ac3020f99ca2b75ad305eb6a74935a
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259901 138bc75d-0d04-0410-961f-82ee72b054a4
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 [copied from libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc with 75% similarity]