https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85632
Bug ID: 85632 Summary: std::filesystem::space or std::experimental::filesystem::space does not return correct information Product: gcc Version: 7.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: bandinfinite at gmail dot com Target Milestone: --- I'm typing this report on my phone so forgive me for not perfect formatting. The bug is simple, filesystem::space() probably won't return correct info for most modern storage device that contain a big enough partition (anything more than 4GB counts). The cause of this bug is simply that the author forgot static_cast<uintmax_t>(data retrieved by statvfs) before the calculation. So the fix is also trivial and can definitely backport to all version contain experimental::filesystem. The latest 8.1 release shares this bug, confirmed with the git mirror hours ago.