{"id":2230562,"url":"http://patchwork.ozlabs.org/api/patches/2230562/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/or7bppmq6y.fsf_-_@lxoliva.fsfla.org/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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":"<or7bppmq6y.fsf_-_@lxoliva.fsfla.org>","list_archive_url":null,"date":"2026-04-29T21:06:45","name":"[FYI,PATCHv2] testsuite: semaphore/try_acquire_until: reorder clock::now calls","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"e6f8b3db8f219a3480503c1f13276d9aa8c745d2","submitter":{"id":74937,"url":"http://patchwork.ozlabs.org/api/people/74937/?format=json","name":"Alexandre Oliva","email":"oliva@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/or7bppmq6y.fsf_-_@lxoliva.fsfla.org/mbox/","series":[{"id":502151,"url":"http://patchwork.ozlabs.org/api/series/502151/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=502151","date":"2026-04-29T21:06:45","name":"[FYI,PATCHv2] testsuite: semaphore/try_acquire_until: reorder clock::now calls","version":1,"mbox":"http://patchwork.ozlabs.org/series/502151/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230562/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230562/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\tdkim=pass (2048-bit key;\n secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=N2+l67cv;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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;\n\tdkim=pass (2048-bit key,\n secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256\n header.s=google header.b=N2+l67cv","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=adacore.com","sourceware.org; spf=pass smtp.mailfrom=adacore.com","server2.sourceware.org;\n arc=none smtp.remote-ip=74.125.82.172"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4g5VJs0tpWz1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 07:08:27 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id E6EFE4BBC0D2\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 21:08:25 +0000 (GMT)","from mail-dy1-f172.google.com (mail-dy1-f172.google.com\n [74.125.82.172])\n by sourceware.org (Postfix) with ESMTPS id 767BC4BB5905\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 21:07:16 +0000 (GMT)","by mail-dy1-f172.google.com with SMTP id\n 5a478bee46e88-2bdd40d3c61so355098eec.1\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 14:07:16 -0700 (PDT)","from free.home ([2804:14c:4d1:41a6::2000])\n by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2ed1bf6d419sm3876914eec.2.2026.04.29.14.07.13\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 29 Apr 2026 14:07:14 -0700 (PDT)","from livre (livre.home [172.31.160.2])\n by free.home (8.15.2/8.15.2) with ESMTPS id 63TL6ll2235082\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Wed, 29 Apr 2026 18:06:53 -0300"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org E6EFE4BBC0D2","OpenDKIM Filter v2.11.0 sourceware.org 767BC4BB5905"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 767BC4BB5905","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 767BC4BB5905","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777496836; cv=none;\n b=f6UcLSrZMFFgKnRsS3pd+kEYNCDisecHEUN6SdY5gqcSZ4hCPr1ClSCvmY/9n8p6Ful2JOdtbwQ7VnlWDRPZRjeg3jFBXnEGOw2/eJfi7ABoSwaP/r4CwKFLBT6LxxoL4Ony/kbJ2ufefypgEkTjeTseEoe20M0K01ugtI8mrlw=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777496836; c=relaxed/simple;\n bh=MSqx7XzPwilTVtCSEaKKDMqcppyGSj4D+EN54AEmWP0=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=NlA0fuJ9kgFbQZ1Agp/BTBxm6C+mxnBeK1DH1p5aw45oKNMAo0JkifocUnmm+Y3vF51GVZXDDkLIPcMG4a94uLAwE2q3wfITT5KfrGL3v0YgRxZRmb6fcTzTJxSp2vc3UsCRBZMeWOsW6syNkkI469COuGu4uB2aiwKFM6S40BU=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=adacore.com; s=google; t=1777496835; x=1778101635; darn=gcc.gnu.org;\n h=mime-version:user-agent:message-id:in-reply-to:date:references\n :organization:subject:cc:to:from:from:to:cc:subject:date:message-id\n :reply-to; bh=cfO+OR7l0QnS6TI9wyEDPr2PDanuL+DkK8cMTDJQGaw=;\n b=N2+l67cvJ2agUAg6LNkdmAOSPe1GvBqoy0JtixY+xOo19zo2fc2AEEVNw+nVgI5AmW\n yXTG8q3+1tdE9FdLmenOIIJUvsIzuAOjdZ68b36nMrwAehug7Nn2vAHnX+o2D4tkdaNI\n hI++CjGG8Hvjs9tGW60ZXNAxitceaKnOOTKGc9Kh3cHKk/2xQyKthl9BQyadZxIhvo5a\n gG5KMSDmlGmaIGreHEP2jtdzDj18oNg6sPJ3GCjc78sYFCeY8bzdoSuaF2CPWMssaNlH\n 2f1jsELCBs/gjortTr8ESP+bl6xrpax7zegemh9Ohx9I4/41ZF77a1ps+Xc1jl3NQjHa\n QvFg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777496835; x=1778101635;\n h=mime-version:user-agent:message-id:in-reply-to:date:references\n :organization:subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=cfO+OR7l0QnS6TI9wyEDPr2PDanuL+DkK8cMTDJQGaw=;\n b=jG3PRACMXQtlTs+r+0SsXprCW5EJw53L1KlDNYpWig2uaJ4KVELtuSJzZbz3BwXrin\n spPMNAeoXb4syWa2ePcboeyMXSZksAUaW+go3qeaUA11H54HbVWmnC9PqFwO7h2foqYs\n wO71IXVznTTDQsqCowdl7u2eep0Dyu2Anf4DpPRw7mNgogy+BRZX3o6ntCUljdBn2F7e\n jfWrfHoRMFmuZpxYmxoRn5REBqv15tdgPnu8jozn6jxjrS68LWoKUzmXzdvuvHy0pTvc\n 8EJDHnu0YF+Gc9e/TTu8ybdw/16D80VYM7HgebnkCYrHi1Bv/wowuihxyqHfk4NFRj54\n XKRA==","X-Gm-Message-State":"AOJu0Yxtfk6u4J524Sov+YcoWsLjgAiJDxgqxo2UCDqVsckQazG3sZwt\n D8yixS+I5XJOoAgX+ZiM56WJsMkxQQRaHbjXWhzddSUTsw/5BWHtlYqWIFOlPLrxSA==","X-Gm-Gg":"AeBDieu7eyfKChQ/SwkeEmXkNk2lRnJ/E4c1peRK+sn0Pa+2Spx3NNXv+pfbKxwB6zQ\n 2FLlxg2OvDXqScefpqk4TxTFPFnaf7aa7MSGoi3QKTUCVWyhdeoVnTqGje+f8pgOAZN/9BFLndU\n 2SXYl9Smtgx5bFvuVLRMHmPIjB7nR/YggHYAb9NrKgBTj9u2YY6XtqSNkk6dPmdaUUJz/qJjpbb\n EJiKZ12b1SrGBogNAOmYreKc5EpevkhxOs0n6NTNS4EXlsxloGGHAvLS/4dPyze6oq76I4qVrXH\n smgljU5wgPxTnBYfdYyen0rz/0OfQ4zXIzTIe6xBqrctDgpL28JAOpltMelZKEqfPrVElIxQMsU\n ay1hnCWT8gczWvp4dRMdNRjrtBmTMSeDwOgrGxfiBTft6QAGwrp9cIpMp4AFc/PHvCgkGjT/ENw\n CHtf12xOpAKw==","X-Received":"by 2002:a05:7300:1c9c:b0:2ed:2942:34ab with SMTP id\n 5a478bee46e88-2ed294236fcmr392541eec.3.1777496835203;\n Wed, 29 Apr 2026 14:07:15 -0700 (PDT)","From":"Alexandre Oliva <oliva@adacore.com>","To":"Jonathan Wakely <jwakely@redhat.com>, hainque@adacore.com","Cc":"gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org","Subject":"[FYI, PATCHv2] testsuite: semaphore/try_acquire_until: reorder\n clock::now calls","Organization":"Free thinker, does not speak for AdaCore","References":"<ormrymmt7w.fsf@lxoliva.fsfla.org>\n <CACb0b4nOexJ_J=Uhf7KJ1VnJTnDqLexa-t=ZSN7v+x2toavuNw@mail.gmail.com>","Date":"Wed, 29 Apr 2026 18:06:45 -0300","In-Reply-To":"\n <CACb0b4nOexJ_J=Uhf7KJ1VnJTnDqLexa-t=ZSN7v+x2toavuNw@mail.gmail.com>\n (Jonathan Wakely's message of \"Wed, 29 Apr 2026 09:32:27 +0100\")","Message-ID":"<or7bppmq6y.fsf_-_@lxoliva.fsfla.org>","User-Agent":"Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)","MIME-Version":"1.0","Content-Type":"text/plain","X-Scanned-By":"MIMEDefang 2.84","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>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"On Apr 29, 2026, Jonathan Wakely <jwakely@redhat.com> wrote:\n\n> On Wed, 29 Apr 2026 at 02:51, Alexandre Oliva <oliva@adacore.com> wrote:\n>> \n>> \n>> Clock calls on VxWorks are slow, so the odds that the consecutive\n>> calls of *clock::now() will yield a different result are not\n>> negligible.  Reordering the calls avoids false positives.\n>> \n>> Regstrapped on x86_64-linux-gnu.  Also tested on ppc-vx7r2 with gcc-15,\n>> with an analogous patch for try_acquire_posix.cc.  Ok to install?\n\n> OK for trunk (and branches if you want, but wait until after 16.1 is released).\n\nThanks, I'm going for trunk only, at least for now.\n\nIn internal review, Olivier Hainque suggested a comment justifying the\nasymmetry, so here's what I plan to check in, barring any objections:\n\n\nClock calls on VxWorks are slow, so the odds that the consecutive\ncalls of *clock::now() will yield a different result are not\nnegligible.  Reordering the calls avoids false positives.\n\n\nfor  libstdc++-v3/ChangeLog\n\n\t* testsuite/30_threads/semaphore/try_acquire_until.cc\n\t(test01): Reorder calls.\n---\n .../30_threads/semaphore/try_acquire_until.cc      |    5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)","diff":"diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc\nindex 44b2b90431a41..a22799d88508a 100644\n--- a/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc\n+++ b/libstdc++-v3/testsuite/30_threads/semaphore/try_acquire_until.cc\n@@ -43,8 +43,11 @@ void test01()\n   }\n \n   {\n-    auto const at = std::chrono::system_clock::now() + dur;\n+    // Set the base time T0 first, so that even if there's a delay before the\n+    // deadline AT is computed, it won't shrink the measured DIFF to the point\n+    // of making it seem shorter than the required wait DURation.\n     auto const t0 = std::chrono::steady_clock::now();\n+    auto const at = std::chrono::system_clock::now() + dur;\n     VERIFY( !s.try_acquire_until(at) );\n     auto const diff = std::chrono::steady_clock::now() - t0;\n     VERIFY( diff >= dur );\n","prefixes":["FYI","PATCHv2"]}