From patchwork Thu Nov 30 10:18:47 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: 171799 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp281485vqy; Thu, 30 Nov 2023 02:19:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7lgc1ByB2xMHBznGsWEAvEfkXWoBRGzLAAAgMFNESDNjBXG0AiPzI4w9b3MSEzZySyZ1R X-Received: by 2002:a67:e909:0:b0:464:4fd1:9387 with SMTP id c9-20020a67e909000000b004644fd19387mr3825682vso.4.1701339579912; Thu, 30 Nov 2023 02:19:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701339579; cv=pass; d=google.com; s=arc-20160816; b=0rlAwsEYJI4aL0tZEKUR2g4jvglIqixecOTpSQe0P1mkvEFa5K5BSpyeJaBUP9YXaj nYHk4O9nzsZ63ctQyD0EcoinpCvCdkt9T2RSCNig+jyDWOQ4px2OggxTD81of0xRFGHg Ndt1Zd4s7raWONZfWxatlZmuNFkvcGCy269UKHqP5+2vHsCq6+5/7zB1HjLcC4K9zqg0 tBpEYG/WtXJhqo6C1/TDm/DPPj4FIGaK+T90/iJ1ad3mKf+o84Cq+U4wAHOH1zJZDGKR W3vMKFVEA/ZN7t+SvXr1hXGaf9sGmhc/D/mLa1w8dhRtEJOuQqSY/0/ljcOV3IDWWZ0I e3gQ== 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=d0y+hQKxZnrZfZocHvoC87LZXtxpd62+N92sh7iKv7E=; fh=VfpjIVwbQyKCLGOH4P8eKpbC0rx5s9zOz2f2H065zJg=; b=h2HmxDpOkWx9hCz/pR4tfEzBRbj4pX5inp97PSre+xcQFpcx2JiqqkLeDAxPKaBziN wUXwb/aMN4fSMzTedXB9BBurxfmYXzvRGyOXTxSRx3h8vmDp8wtIWFlCjgmOli1J3lEx W1totjqlVknALAJouOQi3HZy72eAtceHh8X+z4DyX1iHsT9vCaXktIYsPZiYRcSShXEQ +44YGlM5lMylv3j3mSXO4Cfu5cvlFLjVIfw7kaEX+qxJYOD2GwXL7+YJjUeXSYuvSMQA bjU/YKjzvN2gwSmRfpecQ0Om85Uow7eJ1dSp6wk48IrV1/05OjPQKWfz/RFCCLGlJTCt D9qw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=NFefUWzk; 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 v26-20020a05620a091a00b0077d98b6b820si698560qkv.601.2023.11.30.02.19.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:19:39 -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=NFefUWzk; 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 85DE638618E0 for ; Thu, 30 Nov 2023 10:19:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id A5931385840E for ; Thu, 30 Nov 2023 10:19:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5931385840E 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 A5931385840E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701339544; cv=none; b=RrFBwNErDNo7RU43vtFe4/BB3fVdwxPJuZTPxxrQktbt9swDN/EDpVE2mYwYgyOIoIYShBuxCqgprcxpWFd5pzghguQKs3Gw419ux9LoNOX32Yy4jZvna633fl7LbRzvdJkAEFss6PMNf3PPreYigq5OV1eaAQyiCUie6gXxiyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701339544; c=relaxed/simple; bh=JwRzdjzSkFtqHQYvyHVwZmxfJgxgfHXE9Bnhp+L12wo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=TaweqdkcpZGaEjWW0L0EdICHBSTuqrz20FCzttH1Uigdp9uO/dpTraom91dT9QWIUHcRuezOwFjNAhxntJUo86LvPBKOqPgEhxKcUvAyeZf8SMSZzHXYoC8x2rrRh7heqkOY/Ll1MSbRAlLh9AVg47cUREpIdCjxau1U6LjddGk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4079ed65582so6199465e9.1 for ; Thu, 30 Nov 2023 02:19:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1701339540; x=1701944340; 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=d0y+hQKxZnrZfZocHvoC87LZXtxpd62+N92sh7iKv7E=; b=NFefUWzkhV90sAC3ocYdJiKhOZZn8fSSBHv81PmAFCODu9I5wbdIVXQp2r4da61E54 bRN/jOpQj4SIfdUbc7suJJaL+uzRFfxKPaXgvMEgyTCPM1zKJEWzj5m+ChDISIa8yqmB I0qJkTyg8bpRJSvl9R8eBvrGJK2AELhmie+AdrK3YSsr3g0KBZwzTWxr7ev4AZluzna0 E3Q7g5L3Xcolo6ix2KTeaqiV+1RwVdLgqG8BLgi96o28dEz69nyOjJf+UXm1ORQjyi5y idjIpoY7uUghWPMFmR/Mb5LyKvrljtNOK8/8I/tBU0M5p7pyDa9mNX/rJxSBBXEeibXi 1JfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701339540; x=1701944340; 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=d0y+hQKxZnrZfZocHvoC87LZXtxpd62+N92sh7iKv7E=; b=JmP5SoLj27wbmQKCNmyosy+i2Nsgmp5fAnvA4BwlXoEb3TH9rysTdof3lfB+VbGiG3 hiryUU4It9iQT7SP8l6vIYLNv8rjvilqMgqbSgCCwHCrpFhGWjZXRKg4Lb54qv6UfzNf Repxlr0eDSE9F4NByLzNW/4J4xx6SkWP/x+jUVMLhZY500aFL9Vhi34mt1rx+Oze0DtS mom7T3SbehokoU0t//jacYl4teW/meT/Hv9WkHSNdClRlSG8wqPb36I1awD50D2ku0EW BybUEucbv4gVAEQtwmyf80hviVPv4vsaxZQuM0hs2BKuQHN4QmtcUNID347cwC82lyfJ M2vA== X-Gm-Message-State: AOJu0YxHPDHJcd7xxKdlcdEnSOsu2RuJhBFOmG4NQMpzcjTG8YEJnGhx SKTd2ovP/n8nQL5+OfXlaj830eHPbhpwoZswTrKQpw== X-Received: by 2002:a05:600c:3ba8:b0:40b:36e6:b7ed with SMTP id n40-20020a05600c3ba800b0040b36e6b7edmr15373958wms.7.1701339540299; Thu, 30 Nov 2023 02:19:00 -0800 (PST) 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 j35-20020a05600c1c2300b004076f522058sm5166072wms.0.2023.11.30.02.18.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:18:59 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [COMMITTED] ada: Constant_Indexing used when context requires a variable Date: Thu, 30 Nov 2023 11:18:47 +0100 Message-ID: <20231130101848.3093719-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: 1783983851207450447 X-GMAIL-MSGID: 1783983851207450447 From: Steve Baird In the case of a call with a formal parameter of mode other than "IN" where the corresponding actual parameter is a generalized indexing and the indexable container has both Constant_Indexing and Variable_Indexing aspects specified, the generalized indexing must be interpreted as a variable indexing, not as a constant indexing. In some cases involving a call to a prefixed view of a subprogram, this was not handled correctly. This error results in spurious compile-time error messages saying that the actual parameter in the call "must be a variable". gcc/ada/ * sem_ch4.adb (Constant_Indexing_OK): As a temporary stopgap, return False in the case of an unanalyzed prefixed-view call. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch4.adb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 83705b9dae1..d506944bc8d 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -8473,9 +8473,21 @@ package body Sem_Ch4 is -- resolution does not depend on the type of the parameter that -- includes the indexing operation. - elsif Nkind (Parent (Par)) in N_Subprogram_Call - and then Is_Entity_Name (Name (Parent (Par))) - then + elsif Nkind (Parent (Par)) in N_Subprogram_Call then + + if not Is_Entity_Name (Name (Parent (Par))) then + + -- ??? We don't know what to do with an N_Selected_Component + -- node for a prefixed-notation call to AA.BB where AA's + -- type is known, but BB has not yet been resolved. In that + -- case, the preceding Is_Entity_Name call returns False. + -- Incorrectly returning False here will usually work + -- better than incorrectly returning True, so that's what + -- we do for now. + + return False; + end if; + declare Proc : Entity_Id;