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: 1860776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=VLg1c6fE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SPjQw6JTcz1yQK for ; Tue, 7 Nov 2023 20:22:00 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5141438323C1 for ; Tue, 7 Nov 2023 09:21:43 +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-Google-Smtp-Source: AGHT+IGoZzWlr9kERghm3OxoLHxms4CVDv5ASt+mdMyFXAD9ftbkB9itMLrSKtDJPNIpWMSKtz+JJw== 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+incoming=patchwork.ozlabs.org@gcc.gnu.org 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;