public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/105673] New: _M_futex_wait_until_steady() always falls back to old syscall with FUTEX_WAIT operation even after successful FUTEX_WAIT_BITSET
@ 2022-05-20 15:12 vlad at solidsands dot nl
  2022-05-20 15:59 ` [Bug libstdc++/105673] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vlad at solidsands dot nl @ 2022-05-20 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105673
           Summary: _M_futex_wait_until_steady() always falls back to old
                    syscall with FUTEX_WAIT operation even after
                    successful FUTEX_WAIT_BITSET
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vlad at solidsands dot nl
  Target Milestone: ---

We were doing coverage analysis of GNU libstdc++ library and noticed that in
the function _M_futex_wait_until_steady() (src/c++11/futex.cc) the second part
of the function is always executed even though the FUTEX_WAIT_BITSET syscall is
available on the system.

How to reproduce:
    auto f = std::async(std::launch::async, foo);
    const auto start{std::chrono::steady_clock::now()};
    auto status = f.wait_until(start + std::chrono::seconds{5});

We suspect the reason might be because the if statement on line 217 is missing
an else branch.
(https://gcc.gnu.org/git?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/src/c%2B%2B11/futex.cc;h=4d56c286ec597c19e4dc20bfb0c82d03ee93da8d;hb=HEAD#l217)
The sibling function _M_futex_wait_until() does have an else branch for similar
if statement. Without the else branch if futex syscall was successful the
function still falls back to the alternative version and performs another futex
syscall.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/105673] _M_futex_wait_until_steady() always falls back to old syscall with FUTEX_WAIT operation even after successful FUTEX_WAIT_BITSET
  2022-05-20 15:12 [Bug libstdc++/105673] New: _M_futex_wait_until_steady() always falls back to old syscall with FUTEX_WAIT operation even after successful FUTEX_WAIT_BITSET vlad at solidsands dot nl
@ 2022-05-20 15:59 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2022-05-20 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-05-20

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Good catch, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-20 15:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20 15:12 [Bug libstdc++/105673] New: _M_futex_wait_until_steady() always falls back to old syscall with FUTEX_WAIT operation even after successful FUTEX_WAIT_BITSET vlad at solidsands dot nl
2022-05-20 15:59 ` [Bug libstdc++/105673] " redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).