From patchwork Tue Sep 6 07:16:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp506281wrt; Tue, 6 Sep 2022 00:27:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR5s/R492s6PrjKbhfeh15RkIo7GLH56kR+k1Q/M/Iv0TQ0JsCnQCGVTJl+IiBxynEy48bB1 X-Received: by 2002:aa7:d341:0:b0:44e:67f1:5a2d with SMTP id m1-20020aa7d341000000b0044e67f15a2dmr9263480edr.175.1662449239148; Tue, 06 Sep 2022 00:27:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662449239; cv=none; d=google.com; s=arc-20160816; b=JFC2UWOP3fl9p9p4Jx3nkLV4kHi8+wy1NkocRnnY5hoErkIWgyYKX2Xv7zH4+6QiPu b64rJKREhTqgqU6aeXQt41JxpbmuOLSOLgWwSx2Sd/pG0alsPEVwHS6PrsTYpLtz6x+x LlzEJHSuhkKd4VUytRG3HLUJ/lGr//SBB1CeTaXn8nPpYiHE7GZyTqWxS48p2wmEu3Km Nq+O2zw/SckFksrNP+FJPOKPskBOqi5y/ub4DcScYuPAJVsqFyHuN1+0mJ9D/m/lLox7 h1TjtoZ9+5JqBiti5Iaec5KVCqivrEKrwdYR4pL4d5xV/aUDco+rq2Ooa6etbAe4a9ii ZOyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=NAcPAvHk+J2Q4mxrF07u9WwYTX3Wyj93WnpLhU8gyNw=; b=TJc7s5meKTgm03ODL9a+zLDWUAGqefaaRk3OHd5P/TskwKbiSDDzap3haXS7SsH47W RUZzwd2WLCk2aHsFyU4nvly+Z/CVcl/su2PO2sAaOhctzVcCXlTqIqrsqT//Z9eF1F/k L1ZNwVDpbdh0Mrj7KAcCnUrUHSgDBfVqVrbNus2sUgYO/3sKszu5bT22MucG6LKwAvfc tYl+vMawaIfzGN2oSRgX+j2NHQe7ATPu2xp5p+EchQ8uNt2ohZDK/POacXQrt5P9BfHh QczeJyRz1qm93xVwflBPqyfWN9I5o8Hbacyw8vW6u0jxAMZZs8bxwYSKxEnikblHZiTg nwvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RGXlMOnL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b19-20020a170906709300b007454d48e4basi8359272ejk.451.2022.09.06.00.27.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:27:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=RGXlMOnL; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BEC79393A426 for ; Tue, 6 Sep 2022 07:21:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEC79393A426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662448903; bh=NAcPAvHk+J2Q4mxrF07u9WwYTX3Wyj93WnpLhU8gyNw=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=RGXlMOnLX3KBtKqdCmz0wAw5eh/gQ9bxUpy2hHL8KBOUpJeIOOWGtEgacdXoSbd8O DGzM3AnElIkCSQb1iI3nlx0jGR5FlrHjbSJOhxMw6sz73AIQDKgJd4yBxMMblobzIK WgUxzgLnaYspn78e1fdUM8P1PvEQdo8wtEbUUCHM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by sourceware.org (Postfix) with ESMTPS id A4B2B385042D for ; Tue, 6 Sep 2022 07:16:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A4B2B385042D Received: by mail-wm1-x32f.google.com with SMTP id j26so6389781wms.0 for ; Tue, 06 Sep 2022 00:16:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=NAcPAvHk+J2Q4mxrF07u9WwYTX3Wyj93WnpLhU8gyNw=; b=wmFqs2k+jVkFt5+u/2wtpMFDUP4xTewAsRnp9ddt4ZZrT8BYK0pT4lWTLfDIiady4i WVK8p2jfjBiQxYYcwYbBwanhraNJ7cO1/U785wdaBGiuKpWj0xLlEazuq9yMGuuSNCLi /p47xReRquaZ9FPL3vpXklNOxbId8X6T4Tcudp2n4qYyy5QnzlB+dNrF+TV+tVEoAGWj 6mixXq+A6L1t7qkBF2TSGz5n1nHuK5qxkFFULV5PcORoSEGaiq4BLP//KPpYNmHYpYbI nO/R/o15I+9SWEGXK/NGirCtq8w2kHfpuKokAN7JyA/OFWAXQSLmeOX6177H5GYqrijL +QUQ== X-Gm-Message-State: ACgBeo3cyxCngaOWJ1WFxqrcoVvkXddhnnkloY9P/rpWb52ZGNfFVEiz 8mD22taEXBvUggQdnYzLpfmcovyPLIO35g== X-Received: by 2002:a05:600c:a49:b0:3a6:673a:2a9b with SMTP id c9-20020a05600c0a4900b003a6673a2a9bmr12480914wmq.3.1662448563339; Tue, 06 Sep 2022 00:16:03 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id o24-20020a1c7518000000b003a83ca67f73sm13640912wmc.3.2022.09.06.00.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 00:16:02 -0700 (PDT) Date: Tue, 6 Sep 2022 09:16:02 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Disable lock free protected implementation if target lacks support Message-ID: <20220906071602.GA1280530@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Steve Baird Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743204373637976304?= X-GMAIL-MSGID: =?utf-8?q?1743204373637976304?= Do not select a lock free implementation if Targparm.Support_Atomic_Primitives is False (which indicates that the target cannot support it). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch9.adb (Allows_Lock_Free_Implementation): Return False if Support_Atomic_Primitives is False. diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -64,6 +64,7 @@ with Sinfo; use Sinfo; with Sinfo.Nodes; use Sinfo.Nodes; with Sinfo.Utils; use Sinfo.Utils; with Style; +with Targparm; use Targparm; with Tbuild; use Tbuild; with Uintp; use Uintp; @@ -649,6 +650,10 @@ package body Sem_Ch9 is -- Start of processing for Satisfies_Lock_Free_Requirements begin + if not Support_Atomic_Primitives_On_Target then + return False; + end if; + -- Get the number of errors detected by the compiler so far if Lock_Free_Given then