From patchwork Thu May 25 08:05:31 2023 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: 98844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp195608vqr; Thu, 25 May 2023 01:11:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5vxJuK8UGsg50tj+gJ0V8vregWm362SK2n2xTEb9sxTDJbK4nby4egZgieMFxSS/cd18Me X-Received: by 2002:aa7:da8f:0:b0:510:e556:c842 with SMTP id q15-20020aa7da8f000000b00510e556c842mr3451842eds.23.1685002312127; Thu, 25 May 2023 01:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685002312; cv=none; d=google.com; s=arc-20160816; b=h3SpAjAWqzL05Uuna92XJAZD97ljai6vUmSWGexsYAEZ3Oem4NUkNaO8AOIPw86Zex Lys9dZmdS2U9kYUCOkV/N777OX2AB9/rrVpdrWlKiN9QB4YLIWDpqeLHwdzjapgwBLOj RYugiXjVbZCCsQatEHWyl7gUFIyfbs1b4c2AqUtn1Je1gWkCThL3vUsTyK7+JakCX/uJ 4bUSmK/QdfjHIr4ANHaDsqfvJBcRXwED7u70dugC05h9P2dJ5CH4qsWLHprdJOuAvQtX UdD3K+CzPwu2Ly0/UcwPeCj/vltawg9bFKcYScfSHb48Za0BxqDWavaKbMU5xDndd8mS jiHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=B5XTcZmvByk8mDPWdCor/eFY8Ug/1U5XZsSqatuEl4w=; b=VpMuIbZJeTx5H/hvi+1Z3Q47l37FwyOjBbXf3iwwtkBBWsd9UkQKcNYN4z479Y6odv /HFqa1LTxbJyves+Djp3w0ks3ha/cDTsT1iq9QSbqNMctrN36+y/AmXz9DwhS5SP/sUC bIhkyY/+N+qk5pG8OTgFJJSUEA0mSB3tYC9a3idtD7gmj3iJRuVMyjZTKbIYfEmVuRXb Yy+hVLDJuhtqYVQRd6jYZ1PHqxkp97U2/yCuQ/j2pdGBiKu6mdkCyS9GNnbE2ITHQqyy NuFA+t7iEumgkUe9/rV0VjCaOzXgzPxNIxPayTPVBYNdhGVqTL/huZ7FPZj/JI0+FYpP EqlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="XetuU/8b"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id v3-20020aa7d9c3000000b0050bfd300a00si570158eds.642.2023.05.25.01.11.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 01:11:52 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="XetuU/8b"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 E92DC388200C for ; Thu, 25 May 2023 08:08:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E92DC388200C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685002124; bh=B5XTcZmvByk8mDPWdCor/eFY8Ug/1U5XZsSqatuEl4w=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=XetuU/8bibAByYSk1FA7j19HJZVm+aSD+hMHRxn0QRmOC1jb3hiv9DIYsF/ygKPPv vzwalqxIWoREx5/MqSEwiPRUajCauKsBiwPLdDapcxrYwCO9ZVBPWJE1WT8r/x9PTZ iiealyld0GsWc8Pkrf70n1vdQGs4nsCyHc4Tj4Fs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id 9520D3857346 for ; Thu, 25 May 2023 08:05:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9520D3857346 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f603d4bc5bso2942375e9.3 for ; Thu, 25 May 2023 01:05:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685001933; x=1687593933; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B5XTcZmvByk8mDPWdCor/eFY8Ug/1U5XZsSqatuEl4w=; b=MZUlr0GABq3+Q9GcT1QJGctNTGrxpr3JIYY2tNEsoVCLJSN7u9k2JPOGJ1/nCZblFQ b0jt0f8GEd011aNqn2nUdcuJ1pcEHxscblLXrf1MQg3zNI8owpXMnBrCLMomNaYYrkZk dN/icbnYw0vJe7m7MfwCpLwFDmk50IYCpnl6sH8VbuKt8FJ9YyioFgZeq9sHCjebSyGd 0BNSVQn1zmd3en3V39prYwQI/TkY75SIEUcOj0RmyOSU0NiVRAKTFbmP90AFptLdFIVv CrGRlS2mOHgv/7o7JZ+YDLRT0gOj336qJNiHB6I5j5MsX1D9fpn0e0vcnH3LzTYkwZ5x gGUg== X-Gm-Message-State: AC+VfDyvHgTOWEaqwTq06SZsiePGePae55q304DGC3Gm3p0JZhAJUv43 geB5r/oK1LoRTuarzJiyTnPZTECCSioutq8OiHHEEA== X-Received: by 2002:a05:600c:251:b0:3f6:d2:d8c0 with SMTP id 17-20020a05600c025100b003f600d2d8c0mr1781532wmj.19.1685001933267; Thu, 25 May 2023 01:05:33 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id d7-20020a5d6447000000b0030642f5da27sm892915wrw.37.2023.05.25.01.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 01:05:32 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Ronan Desplanques Subject: [COMMITTED] ada: Handle controlling access parameters in DTWs Date: Thu, 25 May 2023 10:05:31 +0200 Message-Id: <20230525080531.1955918-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 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: =?utf-8?q?Marc_Poulhi=C3=A8s?= 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?1766852984161036548?= X-GMAIL-MSGID: =?utf-8?q?1766852984161036548?= From: Ronan Desplanques This patch improves the way controlling access parameters are handled in dispatch table wrappers. The constructions of both the specifications and the bodies of wrappers are modified. gcc/ada/ * freeze.adb (Build_DTW_Body): Add appropriate type conversions for controlling access parameters. * sem_util.adb (Build_Overriding_Spec): Fix designated types in controlling access parameters. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/freeze.adb | 7 ++----- gcc/ada/sem_util.adb | 7 +++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 6014f71e661..1a1eace600b 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -1555,7 +1555,6 @@ package body Freeze is Par_Prim : Entity_Id; Wrapped_Subp : Entity_Id) return Node_Id is - Par_Typ : constant Entity_Id := Find_Dispatching_Type (Par_Prim); Actuals : constant List_Id := Empty_List; Call : Node_Id; Formal : Entity_Id := First_Formal (Par_Prim); @@ -1571,12 +1570,10 @@ package body Freeze is -- If the controlling argument is inherited, add conversion to -- parent type for the call. - if Etype (Formal) = Par_Typ - and then Is_Controlling_Formal (Formal) - then + if Is_Controlling_Formal (Formal) then Append_To (Actuals, Make_Type_Conversion (Loc, - New_Occurrence_Of (Par_Typ, Loc), + New_Occurrence_Of (Etype (Formal), Loc), New_Occurrence_Of (New_Formal, Loc))); else Append_To (Actuals, New_Occurrence_Of (New_Formal, Loc)); diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b28f2899894..2e2fb911c38 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -2234,9 +2234,12 @@ package body Sem_Util is and then Entity (Formal_Type) = Par_Typ then Rewrite (Formal_Type, New_Occurrence_Of (Typ, Loc)); - end if; - -- Nothing needs to be done for access parameters + elsif Nkind (Formal_Type) = N_Access_Definition + and then Entity (Subtype_Mark (Formal_Type)) = Par_Typ + then + Rewrite (Subtype_Mark (Formal_Type), New_Occurrence_Of (Typ, Loc)); + end if; Next (Formal_Spec); end loop;