From patchwork Tue Nov 7 09:18:54 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: 162324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp111103vqo; Tue, 7 Nov 2023 01:19:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGjKe4mfZ4HMRKaoFZwvks3lyfFXjwe3OJ8SzoZ/1Ujel3TWroWZiqv+EfTeoBRCHkILqVl X-Received: by 2002:a05:622a:34f:b0:41e:21c9:fef7 with SMTP id r15-20020a05622a034f00b0041e21c9fef7mr40840166qtw.63.1699348782900; Tue, 07 Nov 2023 01:19:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699348782; cv=pass; d=google.com; s=arc-20160816; b=MgM/z6Agg05lbnx/IYq/7kYpjQOeh4BGyLXxsFDSX6ox8O3x4/CyHm2Z7Ehq68IrQg KFTPRk1z3Yp0SS978Ix2BV1lxYRDDYQtFFw1AIrlQb2EKxDl8TPXjSDZ785JBQgtl36z TLvrG0X8W/FxkNOmneOjHohFPgFB0PJ+agTCHUQaIjpC6PtxRm6f76tPCgWSehdvULI6 +jZKfZoMQdRww4/IpKk/Cx2jnQ0i1PmMKmtmToklz1YM1QyNLtiWf/BMBM8hvbh7XUbw ICiUUlzddxLeTcCSg6W8w3xN0VQEc7amKJs5w7pvwY5jzOCM3d4geSm9F5cJHIG8VsCt V1jg== 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=a4bEsRJqfC9VM8OYluo+RImRYRSKw0mz06Az/GpmVI8=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=FvrbhwgMJKznsscCwwCE4YFbuw7YsUqetl3vzXIfC3hBwRe3HmnxpOSxXd875x5ms7 Kmihfemg0S8F7Z5iXtGN1vvv969F2QZi8QoWW2CKToF+O2CHbr1dSNnyCAwFrcfYesQA e/D6/tQbs4+9oa6vsPjxCEus6AiNThFiAcvbqagx5IcS4ZSpxgHBaquawRPRe0uQueAc cj9HNjBK2b0GLihg7AzGtnxJWCNn+EZ54WfgxVLka5P98pUD8CI1xrWitO95+CcqAs8z wdcK14tAxh1V0QH7srQgFtIoQyunVLF0HgkyUC3DAliCY2MtKd8UqGX8HnXuVr4t8eOr qXhw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=MLcxavHu; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m13-20020a05622a054d00b003f4ecb4085bsi6858023qtx.289.2023.11.07.01.19.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:42 -0800 (PST) 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=@adacore.com header.s=google header.b=MLcxavHu; arc=pass (i=1); 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=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D2493858C39 for ; Tue, 7 Nov 2023 09:19:41 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 0ABA53858419 for ; Tue, 7 Nov 2023 09:19:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0ABA53858419 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 0ABA53858419 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::535 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348751; cv=none; b=oN+45qWBP5tUL90GFmK21OjHGuLtE6onEiZYwxM0ted5GbPRQQtfsAHd8Fmn8afRmj0c2hw/ht2VMzONarxNDpw1zu+VAe6AY0JGg+Fxk7NGRSMvef9md8v7ja5LNcVd594GqTl9Mkfh5KZisCvhMtyrRhKdMjQAOfWcPbnBl3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699348751; c=relaxed/simple; bh=jOEB/IBn1psIM2bdqUOISF5ILK7BgTMB6paX0wZTRys=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TbXVMbs9HIMOxBd0vCW4cHIixDnYUeLFEKOkAC3AtifBSvtDlrbJeozOjbqJLNfWt9jOhzzsbbZFPdPIPeVFxDng8qQR5uh9TlI9MuYWPRq816W9vooFr0iHpaDWDb3EF8j11iUu0ds6TakMnjeerPmcr5pQt5UHmuRZ6P6SEbI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-53e3b8f906fso9038547a12.2 for ; Tue, 07 Nov 2023 01:19:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1699348746; x=1699953546; 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=a4bEsRJqfC9VM8OYluo+RImRYRSKw0mz06Az/GpmVI8=; b=MLcxavHuhQLeLm9+SrsPcPDm4modu9IbzztIbyPsuKIs+0yE+QrDDopO4vYb0g+lNu CVIP8bLfAcggGXThPQrHZ9j3Yu7Toi/3/s706scivaVWXqH/jf8nQK+nWuGuw8Btji0a kOqDi7vfB5OvmZGjgaje8vqD1dJ2xshbuTosVixwu+Whhu+6PwvWnNv4YdEfE42DILfD bX03eFivYKLeMmiH+6aXDIKps59H1S9immhZozLDGs6XFV7qJ9kR4KLy1eYUgwHv6AoQ hF/fUq7Tfm/85NB+E6ZBmce1rAMxSwjBv3vSOwU8euzCILOhsTZ8Xt8UmyfSElsaOhwI zopg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699348746; x=1699953546; 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=a4bEsRJqfC9VM8OYluo+RImRYRSKw0mz06Az/GpmVI8=; b=AICQrOXjhYuuxoNiFjeKaKDmGUhVZMgEBDNd7h8pL7Mdh0bmurxbxc7JSInWAI6Ln3 9rG/RlibUDhJqC0UtVi8qA8MdNeiPx3DLKfedCKC3/QRI7mFX0qe+csLGWjGqIOGP3eK XYdlABG9JdRjDcy1PH8mKuJIkw2GmbaIDpRInE20DAqkrtBxttlm4nf7byya64Ui+M6T YZ9bkMBN1+/RrJcGXlZ00swzEWaaL+LyKSoHK02/PZDd9D1ONPJiHISFGGOpzXjYE+g8 2N03KWLul3DCMq+ebD4IdIy3E6IwW5+xWrMR/6HAkVFU/82o7icN8ZQz7ijbPTXMNjWA wYQQ== X-Gm-Message-State: AOJu0YytIG45tA2gXn7RpIyx7P695+bPE2S6TW1Er61f++zsVBO0l3Db Y464WdanLO8WZLkXyuVFvtvo2F8uEt+BqWf4ZCAqOQ== X-Received: by 2002:a17:907:3183:b0:9e0:dcf:17f6 with SMTP id xe3-20020a170907318300b009e00dcf17f6mr5000601ejb.58.1699348746615; Tue, 07 Nov 2023 01:19:06 -0800 (PST) Received: from localhost.localdomain ([2001:861:3382:1a90:dbc1:a1d1:2e58:4040]) by smtp.gmail.com with ESMTPSA id w10-20020a5d404a000000b0031f82743e25sm1791472wrp.67.2023.11.07.01.19.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:19:05 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on address of element of packed array component Date: Tue, 7 Nov 2023 10:18:54 +0100 Message-ID: <20231107091854.3904987-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: 1781896349312007677 X-GMAIL-MSGID: 1781896349312007677 From: Eric Botcazou This occurs when the component is part of a discriminated type and its offset depends on a discriminant, the problem being that the front-end generates an incomplete Bit_Position attribute reference. gcc/ada/ * exp_pakd.adb (Get_Base_And_Bit_Offset): Use the full component reference instead of just the selector name for 'Bit_Position. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_pakd.adb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index c3908a54538..ad12aec1e23 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -2112,8 +2112,8 @@ package body Exp_Pakd is -- We build up an expression serially that has the form - -- linear-subscript * component_size for each array reference - -- + field'Bit_Position for each record field + -- linear-subscript * component_size for each array component ref + -- + pref.component'Bit_Position for each record component ref -- + ... loop @@ -2135,7 +2135,7 @@ package body Exp_Pakd is elsif Nkind (Base) = N_Selected_Component then Term := Make_Attribute_Reference (Loc, - Prefix => Selector_Name (Base), + Prefix => Base, Attribute_Name => Name_Bit_Position); else