From patchwork Tue Nov 7 09:20:50 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: 162338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp112248vqo; Tue, 7 Nov 2023 01:22:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbbEMeNxS0dhEr7QB5dte1eUHFx6rSLEK+J1RgeqKEWix8oODPhsICiYdvVOgv8CjedXwo X-Received: by 2002:a05:620a:4c4:b0:774:2113:7432 with SMTP id 4-20020a05620a04c400b0077421137432mr30598131qks.67.1699348969126; Tue, 07 Nov 2023 01:22:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348969; cv=pass; d=google.com; s=arc-20160816; b=nlXOl+V2KKd6PtIaZIbJ3bVzc3m91dwMsEIZoUOzf4i0J6YziWpKZl08d8OkJrII1h Do95MtKU2VJfgwjILWPx0AWtS50pc52NBakK/kltefxMwXXXtwjLQ6GMBdxuaSSBwTDY nuq6J1gEmN0VHjvH9MA1uHJKZuwV62hfTSTF5BqNZmDNS7bjQVi8v93T3IQIRhQjK4Y3 za+xX13jKIBqEPFwbW8mMP9raTIZXoWYneY+ecd63m2IytMmRVQmr2tIZ9FWi0Ib9Sft 4IP9DyjLD1C8BK6wxs4JzOsdJUcoYvw1TzrIQd0rxHFHpjfjCdthEL9H1vlDnVc9Lqlm A5yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=gDrK9FUD/cChaJCbc2VFbMn0vcjve1TgWsluyZiYZiQ=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=RunCmd7yqlCZXYkc7mkwRWf/+Et2QHvUTcRne+VyAW5X6NIyrC0765ek2lxSGiCuU9 Svd6jIz8Xi7f7r2ON50pJ1tYFhsfkVPqat/+TZwAMynU4T8bbTUTL45ZA+m3Y4HE44Ok mBBXSGr/Pr1R1U7GIaKwPzfw/8X4G97LdSeAZoKQwj0dANItVkJtnlXEKLqTsmvNLLoq zNjdHRdVxLOqseVc6SEfy2Gal+KKsjg+sXYCxV1EqzXDENrqxvmYCx3H63HV2UZ45c00 hNE2vgCTqn+/6Wfjzr2O0h2nCX4XcUWsYQTy+BZTwVrsHz5fmrYyGw4SWVE5PYj2s3l5 qHVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=VLg1c6fE; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s22-20020ae9f716000000b0076ef0378208si6692365qkg.731.2023.11.07.01.22.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:22:49 -0800 (PST) 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=@adacore.com header.s=google header.b=VLg1c6fE; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B352385DC01 for ; Tue, 7 Nov 2023 09:21:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by sourceware.org (Postfix) with ESMTPS id 5E569385624C for ; Tue, 7 Nov 2023 09:20:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E569385624C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5E569385624C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348857; cv=none; b=nxEcsmPIe7s8fN9TBocK6qSqBtU3giSYRajhcY/q3KX2DiDbP+mX4TCN3HbXbxBTL86LNX+GXJMHA2BGwE08X2CM+04a3TQEAMyw6uY9zIXKyYSbv0/k0e6qJRc6v1Wk6jbrJhdsJX1626nYDyRMHz4ExGOrYsXO3U7XsAY/ozw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348857; c=relaxed/simple; bh=B9xNJ1Sikty4YqgwXK+S0qXoqsfW8QRDTdy+SSIWXE4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Oi2WkzpSNTfgzU03oQgF2ypfsWNzz0tOEN45/lpCyhaX71Yi7kGKbw52/pt+L6v10e5Jjel7lV3Au+613vOFwMHvUTBiiEMi9WtONnrJakB72ulCiwJ1BzhsSRLABDp84yPpSSQqZNeas3VLxbW9ln+JmnPt+S/uvk/nULM9fc4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-507f1c29f25so7123394e87.1 for ; Tue, 07 Nov 2023 01:20:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348853; x=1699953653; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=gDrK9FUD/cChaJCbc2VFbMn0vcjve1TgWsluyZiYZiQ=; b=VLg1c6fEutMuBR1avOGOqqw1+gUf8hAWfbwy2NSJyNPEOEfEvxiUhoaeGLtLSiDrhO 6+4DE3Vqnx+TLtfQfjN2xE2VCR1yEkdW3AlMZnYOhu02fqeBfnqyoeXKSwO/wTG2tKTl Dm5GZ1Ywqpy9DpM8y5/lWkEYfllGTomw4xijHJ1OMpDdYT8QXICf6Fgr7bmKoya9L2B4 CrDE5LjPj5cumN4fr2YDcveJ2JLvqPtVoH1M6FWGSjZ60M4u8HW+QgKhYFZrJI2m6fH/ U/ENpT9FTmgWWxaX1g17YriYnRHz78Sr+a+xFNrEsRq9K3t669WhJar+PneqFCB2UeQj vBYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348853; x=1699953653; 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=gDrK9FUD/cChaJCbc2VFbMn0vcjve1TgWsluyZiYZiQ=; b=EumGVhNM4cAfwUDVlQAsvdEszPp/uZ9hpUDWq6KKNsvmjfpO0bHY2j+R47o+0i41lv sZXFoBxU8YKajjX4gdRLfz96jkFDqPM+Yg21QXTO70YZvPd2zmN07YPdvTajYK8aMKyZ JVnNWGWpIkrdxU7g04XiK73kfsnBjzai9xykaF8yqBUtduuSNWFB7tXPx+ek7CYCyX6b hY3v/AhsHYnlqq+N9ilDw+qBXMd24kqWgKSz6nHIXRaFOssSf5CPVmiwfjOKlZvfa4eI HQOrrhjYCbAbnUTGzcPj9C30PIkqhaBIaRA7KfUXtQajvN4BVzaePvoxY+5ugezcMR3L mKJQ== X-Gm-Message-State: AOJu0YyE52t8jp5tyNY698MTE7oNfs3SDbSMvlYLm/F2n0zUqXhg3mgc nJ/Y+ZLexuBEVnfC+wSHOfb/uqoGuoQg1GlByoN/lw== X-Received: by 2002:a05:6512:52c:b0:509:dee:f70c with SMTP id o12-20020a056512052c00b005090deef70cmr21748938lfc.27.1699348853019; Tue, 07 Nov 2023 01:20:53 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id p1-20020a5d68c1000000b0032da022855fsm1786651wrw.111.2023.11.07.01.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:20:52 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix debug info for aliased packed array with unconstrained nominal subtype Date: Tue, 7 Nov 2023 10:20:50 +0100 Message-ID: <20231107092050.3907141-1-poulhies@adacore.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781896544830258635 X-GMAIL-MSGID: 1781896544830258635 From: Eric Botcazou The front-end now rewrites it as a renaming when it is initialized with a function call and the same processing must be applied in the renaming case as in the regular case for this kind of special objects. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) : Apply the specific rewriting done for an aliased object with an unconstrained array nominal subtype in the renaming case too. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/gcc-interface/decl.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index 20ab185d577..95fa508c559 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -1145,6 +1145,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) the entity as indirect reference to the renamed object. */ if (Materialize_Entity (gnat_entity)) { + /* If this is an aliased object with an unconstrained array + nominal subtype, we make its type a thin reference, i.e. + the reference counterpart of a thin pointer, exactly as + we would have done in the non-renaming case below. */ + if (Is_Constr_Subt_For_UN_Aliased (gnat_type) + && Is_Array_Type (gnat_und_type) + && !type_annotate_only) + { + tree gnu_array + = gnat_to_gnu_type (Base_Type (gnat_type)); + gnu_type = TYPE_OBJECT_RECORD_TYPE (gnu_array); + } gnu_type = build_reference_type (gnu_type); const_flag = true; volatile_flag = false;