[Bug libstdc++/68921] New: [5/6 Regression] std::future::wait() makes invalid futex calls and spins
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 15 18:03:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68921
Bug ID: 68921
Summary: [5/6 Regression] std::future::wait() makes invalid
futex calls and spins
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
CC: torvald at gcc dot gnu.org
Target Milestone: ---
Target: i?86-*linux*
On 32-bit linux the following spins in a tight loop until it times out:
#include <future>
#include <thread>
int main() {
std::promise<void> p;
auto f = p.get_future();
std::thread t([&p](){
std::this_thread::sleep_for(std::chrono::seconds(10));
p.set_value();
});
f.wait();
t.join();
}
strace shows thousands of invalid calls:
futex(0x8cf2a24, FUTEX_WAIT, 2147483648, {4289120584, 134527555}) = -1 EINVAL
(Invalid argument)
It's called from the infinite loop in
__atomic_futex_unsigned::_M_load_and_test_until in <bits/atomic_futex.h>
More information about the Gcc-bugs
mailing list