From patchwork Fri May 26 07:35:59 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: 99336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp290431vqr; Fri, 26 May 2023 00:40:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UtXToiId4ZD2oqPYoWyKOoZo2tfM0sErc30JOHZaYtpe5reTNzjLaEuj1D8qvXC9zjdMH X-Received: by 2002:a05:6402:1d4b:b0:504:77ed:5a33 with SMTP id dz11-20020a0564021d4b00b0050477ed5a33mr5183026edb.8.1685086824260; Fri, 26 May 2023 00:40:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685086824; cv=none; d=google.com; s=arc-20160816; b=vGyjTwIsijkgK0ab1X0S9iKImn9lxkQY4VfKjm/LgmExKU6rLJOkeLyfywZa5DVTgv QgnXsFdw28MAvsDzyeLVouVk0TvJwVs9r43ntTpbTrs/pzFV2eKMjqNa0wSYGQD08TrF OA/taDxDRQmIl5A34UiruS1p/wf751kRUVmbTZEM3LiU8g/PehoBdh9gY1nsvHVQuZ6P JDWmLxOAaJi3GiRUiOWeWzXqa1vXeq1Rzxv3BkyFieUq+8wKQLtBKrQs//zhmr/j3xkJ bwYlYwJinvOQ0rKniRhlwqyavbmLg9rC1dMNT+CYmZDRTbqWrylrt7KSAkwQTyErAby7 NkEw== 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=rilRdZJoDL8eG0bQKsdWHcxSrctd9IX08PeTNvSQVJ8=; b=gGoQOUvgK5r8wx/CVqvZgHxoij8ueeVG932AnSmAAA4sQ/ADFKAaz2EJ+7mtW4kh6S M/MQ53JMK22g4yPjRNcLDLGW0nU+bAw98GyuiQykEY173qbdQTVrfNLcKTmzGybSh0N2 UWtCivlp1p2UZSyyUO/ntCjskkNHEGwXpdtWNn7EFIHOBG/7vT1Ksd/OufdYWGpw6IAs dEqwKS15iS/gZl6DSUDPx2jlflv71zPDBiU17A5pH7kY5gjeUzXDUxA494tWuvzeDCME T8Ekkjo0zG8XqSaEvCPIxOHsqzUkHCiAIA5+l2GK+nziKQbC9bMbPkBHa0p7Rf4RDb6O CQzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CWNWI4L1; 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 w19-20020a056402129300b005126ee9207esi250841edv.17.2023.05.26.00.40.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:40:24 -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=CWNWI4L1; 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 DFC083839DEB for ; Fri, 26 May 2023 07:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFC083839DEB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086679; bh=rilRdZJoDL8eG0bQKsdWHcxSrctd9IX08PeTNvSQVJ8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=CWNWI4L1DzYPgNLdP/1Muap9YB/gQwGQWVW8ku2fcScZ0otMuBVIaGBPnUveyu61J 5tK+ZcuMBsN9ARDMl2X/Za5Wu5/182U0xaA58D+Feh3vgKYDVO/c17OSlZUnTRd8wH EkXFU8OfOC6lxYaZPujxn6s8b7KqYABtYXm6Ttwg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 89724385E011 for ; Fri, 26 May 2023 07:36:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89724385E011 Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-30abe551605so383155f8f.0 for ; Fri, 26 May 2023 00:36:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685086561; x=1687678561; 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=rilRdZJoDL8eG0bQKsdWHcxSrctd9IX08PeTNvSQVJ8=; b=az3pLGI5cwYXS0byO+49XSqYi08El+Jf+ZlUL7dGe6hoMEzGP/xxd0PeU8lqiuPrjf PbQN6Ykw3XAAaDpMHEuQJBLDk4oa/GJvXCZdTJKtAiux4WZ/RuqxkqbzalyPOEner+1H qDvSHs2WX6OVQF+Zntm12PbV/2mADYZNu0yDJu17GV0HHsfa4rj9CW9gRhGXgGkTzgjY SrB7PJTm5tICyzbknxzpw1havIp562lIYlkb01+7fnsX2Q7GHutKgOzRTfEdevIC2ObP r1wmuF7OHTRK8/Fmn0mBuTuTcSzPm9aR6YoqIKZVmKStyMjcv8YjGpFfo1ulmiWYvw+q RYjw== X-Gm-Message-State: AC+VfDze35UNz8A4vRwIyhqMr5YmsaFq+YeEztw6T3qkI2SjEh4GKj7X AKOZT8vSxLZSM/avDDi9JOciT6VVK6YGnH7mMY7qIg== X-Received: by 2002:a5d:60d0:0:b0:307:7be5:90d7 with SMTP id x16-20020a5d60d0000000b003077be590d7mr575097wrt.10.1685086561361; Fri, 26 May 2023 00:36:01 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:777b:eef4:6f79:f26f]) by smtp.gmail.com with ESMTPSA id y15-20020a5d4acf000000b00306299be5a2sm4157857wrs.72.2023.05.26.00.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 00:36:00 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Ghjuvan Lacambre Subject: [COMMITTED] ada: Handle new Controlling_Tag format when converting to SCIL Date: Fri, 26 May 2023 09:35:59 +0200 Message-Id: <20230526073559.2068284-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?1766941601585309080?= X-GMAIL-MSGID: =?utf-8?q?1766941601585309080?= From: Ghjuvan Lacambre This commit fixes two CodePeer crashes that were introduced when the format of the controlling tag changed. gcc/ada/ * exp_disp.adb (Expand_Dispatching_Call): Handle new Controlling_Tag. * sem_scil.adb (Check_SCIL_Node): Treat N_Object_Renaming_Declaration as N_Object_Declaration. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_disp.adb | 34 ++++++++++++++++++++++++++-------- gcc/ada/sem_scil.adb | 5 +++-- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index e7cae38d553..494ead7c144 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -1133,18 +1133,36 @@ package body Exp_Disp is Set_SCIL_Controlling_Tag (SCIL_Node, Parent (Entity (Prefix (Controlling_Tag)))); - -- For a direct reference of the tag of the type the SCIL node - -- references the internal object declaration containing the tag - -- of the type. + -- Depending on whether a dereference is involved, the SCIL node + -- references the corresponding object/parameter declaration or + -- the internal object declaration containing the tag of the type. elsif Nkind (Controlling_Tag) = N_Attribute_Reference and then Attribute_Name (Controlling_Tag) = Name_Tag then - Set_SCIL_Controlling_Tag (SCIL_Node, - Parent - (Node - (First_Elmt - (Access_Disp_Table (Entity (Prefix (Controlling_Tag))))))); + declare + Prefix_Node : constant Node_Id := Prefix (Controlling_Tag); + Ent : constant Entity_Id := Entity + (if Nkind (Prefix_Node) = N_Explicit_Dereference then + Prefix (Prefix_Node) + else + Prefix_Node); + + begin + if Ekind (Ent) in E_Record_Type + | E_Record_Subtype + | E_Record_Type_With_Private + then + Set_SCIL_Controlling_Tag (SCIL_Node, + Parent + (Node + (First_Elmt + (Access_Disp_Table (Ent))))); + + else + Set_SCIL_Controlling_Tag (SCIL_Node, Parent (Ent)); + end if; + end; -- Interfaces are not supported. For now we leave the SCIL node -- decorated with the Controlling_Tag. More work needed here??? diff --git a/gcc/ada/sem_scil.adb b/gcc/ada/sem_scil.adb index 7c75c9d66bc..da8fab69a97 100644 --- a/gcc/ada/sem_scil.adb +++ b/gcc/ada/sem_scil.adb @@ -88,8 +88,9 @@ package body Sem_SCIL is -- object or parameter declaration. Interface types are still -- unsupported. - elsif Nkind (Ctrl_Tag) in - N_Object_Declaration | N_Parameter_Specification + elsif Nkind (Ctrl_Tag) in N_Object_Renaming_Declaration + | N_Object_Declaration + | N_Parameter_Specification then Ctrl_Typ := Etype (Defining_Identifier (Ctrl_Tag));