https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118093
Bug ID: 118093
Summary: std::future::wait_until futex call returns EINVAL for
negative timeout smaller than 1s
Product: gcc
Version: 15.0
URL: https://gcc.gnu.org/pipermail/gcc-patches/2024-July/65
8118.html
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
William Tsai reported this and contributed a patch fixing it:
https://gcc.gnu.org/pipermail/gcc-patches/2024-July/658118.html
#include <chrono>
#include <future>
int main()
{
std::promise<void> p;
std::chrono::system_clock::time_point tp(std::chrono::milliseconds{-10});
(void) p.get_future().wait_until(tp);
}
../../../../../libstdc++-v3/src/c++11/futex.cc:145: bool
std::__atomic_futex_unsigned_base::_M_futex_wait_until(unsigned int*, unsigned
int, bool, std::chrono::seconds, std::chrono::nanoseconds): Assertion
'(*__errno_location ()) == 4 || (*__errno_location ()) == 11 ||
(*__errno_location ()) == 110 || (*__errno_location ()) == 38' failed.
Aborted (core dumped)
There's a simpler fix though:
https://gcc.gnu.org/pipermail/gcc-patches/2024-December/671852.html