https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69204

--- Comment #6 from Dmitry Vyukov <dvyukov at google dot com> ---
The problem is that gcc does not instrument atomic operations for some reason.

Here is disasm of future::set_result:

Dump of assembler code for function
std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base,
std::__future_base::_Result_base::_Deleter> ()>, bool):
...
   0x000000000048bebd <+301>:   mov    -0x40(%rbp),%rax
   0x000000000048bec1 <+305>:   mov    -0x44(%rbp),%edx
   0x000000000048bec4 <+308>:   xchg   %edx,(%rax)
   0x000000000048bec6 <+310>:   mov    %edx,%eax
   0x000000000048bec8 <+312>:   shr    $0x1f,%eax
   0x000000000048becb <+315>:   test   %al,%al
   0x000000000048becd <+317>:   je     0x48bef5
<std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base,
std::__future_base::_Result_base::_Deleter> ()>, bool)+357>
   0x000000000048becf <+319>:   mov    -0x38(%rbp),%rax
   0x000000000048bed3 <+323>:   mov    %rax,%rdi
   0x000000000048bed6 <+326>:   callq  0x407550
<_ZNSt28__atomic_futex_unsigned_base19_M_futex_notify_allEPj@plt>
...
   0x000000000048bf1c <+396>:   retq   

That xchg is supposed to be std::atomic<unsigned>::store(memory_order_release)
that marks the future as ready.

I have no idea what has regressed.

Reply via email to