{"id":2226320,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2226320/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhubrmqub2.gcc.gcc-TEST.redi.31.1.6@forge-stage.sourceware.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.2/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<bmm.hhubrmqub2.gcc.gcc-TEST.redi.31.1.6@forge-stage.sourceware.org>","list_archive_url":null,"date":"2026-04-22T10:44:21","name":"[v1,06/16] libstdc++: Fix time_point conversion in atomic timed waits","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"da74750036b2eda7afc270eab02854f3b6725d48","submitter":{"id":93210,"url":"http://patchwork.ozlabs.org/api/1.2/people/93210/?format=json","name":"Jonathan Wakely via Sourceware Forge","email":"forge-bot+redi@forge-stage.sourceware.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhubrmqub2.gcc.gcc-TEST.redi.31.1.6@forge-stage.sourceware.org/mbox/","series":[{"id":500987,"url":"http://patchwork.ozlabs.org/api/1.2/series/500987/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=500987","date":"2026-04-22T10:44:17","name":"atomic wait/notify ABI stabilization","version":1,"mbox":"http://patchwork.ozlabs.org/series/500987/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2226320/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2226320/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org","sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org","server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0xlB1T7Xz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 21:27:02 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 878B642DAB19\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 11:26:46 +0000 (GMT)","from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id 6A52D409EB5F\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:46:05 +0000 (GMT)","from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id C8F9242BB4\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 10:46:01 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 878B642DAB19","OpenDKIM Filter v2.11.0 sourceware.org 6A52D409EB5F"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 6A52D409EB5F","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 6A52D409EB5F","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776854765; cv=none;\n b=S6UI3K42x7pFhl/QIKNM8TrpYG4LbSnP5rqNDvDAtG4LWYYhhBSwNwnrhmvWegX/2XpQcligoIfmNt4+etVu94aBCvRK+q9mJbDdmSHTaYWrqOaHq9rEbMW6Pwg9SBXQaZT3Y9uzWp8QBbRimW+nwF3zh3PBANAzVhIpJUxWtp0=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776854765; c=relaxed/simple;\n bh=En5PMQRgAOiNoXCORSgQIkebXCztFxIDWJrvUY6knhw=;\n h=From:Date:Subject:To:Message-ID;\n b=NsKASm4fcV+rESzBDNmgl+LjNB8hFOPxWxzaCUxnz65FnYLgmuCoYm3x2pbpiwv9vaBn2UkzuEK+GvO/Zn2cY2TN9Jh5sposnDqCu5B22AE4pqTbeyPwez+Wmt3NxE1BDpi5aFyFkKO7KPOW6gtb1Po7yeZOxDzY79zp3ipWuTc=","ARC-Authentication-Results":"i=1; server2.sourceware.org","From":"Jonathan Wakely via Sourceware Forge\n <forge-bot+redi@forge-stage.sourceware.org>","Date":"Wed, 22 Apr 2026 10:44:21 +0000","Subject":"[PATCH v1 06/16] libstdc++: Fix time_point conversion in atomic timed\n waits","To":"gcc-patches mailing list <gcc-patches@gcc.gnu.org>","Message-ID":"\n <bmm.hhubrmqub2.gcc.gcc-TEST.redi.31.1.6@forge-stage.sourceware.org>","X-Mailer":"batrachomyomachia","X-Pull-Request-Organization":"gcc","X-Pull-Request-Repository":"gcc-TEST","X-Pull-Request":"https://forge.sourceware.org/gcc/gcc-TEST/pulls/31","References":"\n <bmm.hhubrmqub2.gcc.gcc-TEST.redi.31.1.0@forge-stage.sourceware.org>","In-Reply-To":"\n <bmm.hhubrmqub2.gcc.gcc-TEST.redi.31.1.0@forge-stage.sourceware.org>","X-Patch-URL":"\n https://forge.sourceware.org/redi/gcc/commit/5251e4738b31afe644796a80a9507dd2cb1ec908","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Reply-To":"gcc-patches mailing list <gcc-patches@gcc.gnu.org>, redi@gcc.gnu.org","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"From: Jonathan Wakely <jwakely@redhat.com>\n\nEven if a time_point already uses the right clock, we might still need\nto convert it to use the expected duration. Calling __to_wait_clock will\nperform that conversion, so use that even when the clock is correct.\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/atomic_timed_wait.h (__to_wait_clock): Do not use\n\tchrono::ceil if clock and duration are already correct type.\n\t(__wait_until): Always call __to_wait_clock.\n---\n libstdc++-v3/include/bits/atomic_timed_wait.h | 34 +++++++++----------\n 1 file changed, 17 insertions(+), 17 deletions(-)","diff":"diff --git a/libstdc++-v3/include/bits/atomic_timed_wait.h b/libstdc++-v3/include/bits/atomic_timed_wait.h\nindex 9fc28f3d2696..a916c10879b7 100644\n--- a/libstdc++-v3/include/bits/atomic_timed_wait.h\n+++ b/libstdc++-v3/include/bits/atomic_timed_wait.h\n@@ -70,7 +70,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t\t\t\t\t       _Dur>& __atime) noexcept\n       {\n \tusing __w_dur = typename __wait_clock_t::duration;\n-\treturn chrono::ceil<__w_dur>(__atime);\n+\tif constexpr (is_same_v<__w_dur, _Dur>)\n+\t  return __atime;\n+\telse\n+\t  return chrono::ceil<__w_dur>(__atime);\n       }\n \n #ifdef _GLIBCXX_HAVE_LINUX_FUTEX\n@@ -222,22 +225,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n       __wait_until(const __platform_wait_t* __addr, const __wait_args_base& __args,\n \t\t   const chrono::time_point<_Clock, _Dur>& __atime) noexcept\n       {\n-\tif constexpr (is_same_v<__wait_clock_t, _Clock>)\n-\t  return __detail::__wait_until_impl(__addr, __args, __atime);\n-\telse\n-\t  {\n-\t    auto __res = __detail::__wait_until_impl(__addr, __args,\n-\t\t\t\t\t\t     __to_wait_clock(__atime));\n-\t    if (!__res.first)\n-\t      {\n-\t\t// We got a timeout when measured against __clock_t but\n-\t\t// we need to check against the caller-supplied clock\n-\t\t// to tell whether we should return a timeout.\n-\t\tif (_Clock::now() < __atime)\n-\t\t  __res.first = true;\n-\t      }\n-\t    return __res;\n-\t  }\n+\tauto __at = __detail::__to_wait_clock(__atime);\n+\tauto __res = __detail::__wait_until_impl(__addr, __args, __at);\n+\n+\tif constexpr (!is_same_v<__wait_clock_t, _Clock>)\n+\t  if (!__res.first)\n+\t    {\n+\t      // We got a timeout when measured against __clock_t but\n+\t      // we need to check against the caller-supplied clock\n+\t      // to tell whether we should return a timeout.\n+\t      if (_Clock::now() < __atime)\n+\t\t__res.first = true;\n+\t    }\n+\treturn __res;\n       }\n \n     // Returns {true, val} if wait ended before a timeout.\n","prefixes":["v1","06/16"]}