From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 56FFA3856DCA; Fri, 20 May 2022 15:12:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56FFA3856DCA From: "vlad at solidsands dot nl" To: gcc-bugs@gcc.gnu.org Subject: [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 Date: Fri, 20 May 2022 15:12:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vlad at solidsands dot nl X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2022 15:12:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105673 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 p= art of the function is always executed even though the FUTEX_WAIT_BITSET syscal= l is available on the system. How to reproduce: auto f =3D std::async(std::launch::async, foo); const auto start{std::chrono::steady_clock::now()}; auto status =3D f.wait_until(start + std::chrono::seconds{5}); We suspect the reason might be because the if statement on line 217 is miss= ing an else branch. (https://gcc.gnu.org/git?p=3Dgcc.git;a=3Dblob;f=3Dlibstdc%2B%2B-v3/src/c%2B= %2B11/futex.cc;h=3D4d56c286ec597c19e4dc20bfb0c82d03ee93da8d;hb=3DHEAD#l217) The sibling function _M_futex_wait_until() does have an else branch for sim= ilar if statement. Without the else branch if futex syscall was successful the function still falls back to the alternative version and performs another f= utex syscall.=