From patchwork Mon Sep 26 09:14:58 2022 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: 1682480 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=JP5zy23Z; dkim-atps=neutral Received: from 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 (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MbcYg10jBz1ypH for ; Mon, 26 Sep 2022 19:15:51 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F0F33858295 for ; Mon, 26 Sep 2022 09:15:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F0F33858295 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664183749; bh=fZTjOTdN4t7QPpnOWeMYobS5Dwa+5488hJOAC/ZmKsg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=JP5zy23ZOa3iuw7lqX1nzVpzWmJ8YoPf3LkRc2embRGcUJGrtgIlXsz4MNTgCJSeo KByagSmysi7ZuACJw+sr0mLDx8zIGXLQxxNGzXkGvyXbXfQroIn4b6BujQc2yXxCxm E+6LAiM4UhdXoYEbLY7ZU1J0vqO4opBleLBR8UYE= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id A59C53856DC0 for ; Mon, 26 Sep 2022 09:15:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A59C53856DC0 Received: by mail-wm1-x32b.google.com with SMTP id n40-20020a05600c3ba800b003b49aefc35fso3342430wms.5 for ; Mon, 26 Sep 2022 02:15:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=fZTjOTdN4t7QPpnOWeMYobS5Dwa+5488hJOAC/ZmKsg=; b=yCHYOLy7rPM9TEcJwsSdQpWuHAYvGYQ74r/EHO5d4P71jdkJNB55lt5hV9LaIdKHxS S2Eeiq/g1uVA+bSUI2teESK1JfyarN+wfAYeXKDZOaB6H56+0vjjevL8AcYbAEAQ/iQl 5beW1Ld00NBCe8HqBKhWsCJ1FPjGHNZC1c0/KRQKrSs0D/SQg5Cjh4uGfhV/JDsqBGZf TniwewPlGYftRpiVdT7ZE11Oaltv6QobEBrmL8m0pT6dp6Lk+OIMLJMVfjL0bvcS8k3i 10tPKW1z2IiIUgMYkRc9OaY1Xl4sHgFN3lJ4kHYmAAbCdjmEsT8XjBlbYd4GTxWsVxx0 fGPg== X-Gm-Message-State: ACrzQf2NbEwG+0nz6wJo3zifZZ8Mg0cZLb9MbmDqoIH0iCPAo0ky01pu AgQqilsFlt0nSudfCw1rZQ/h9GTFNBolrg== X-Google-Smtp-Source: AMsMyM58G9V4aRi6LBa2y6YurQFYhEwDxrvKtnEibpV/zV4wMKOmSl+iw1Dh7YnRWLSRY/V6xIkwGw== X-Received: by 2002:a7b:c7d8:0:b0:3b4:5c41:6a6c with SMTP id z24-20020a7bc7d8000000b003b45c416a6cmr13878912wmk.139.1664183702452; Mon, 26 Sep 2022 02:15:02 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id i14-20020a5d558e000000b00224f7c1328dsm13657084wrv.67.2022.09.26.02.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:15:02 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [COMMITED] ada: Delay expansion of iterated component association Date: Mon, 26 Sep 2022 11:14:58 +0200 Message-Id: <20220926091458.273107-1-poulhies@adacore.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 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 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?= Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" From: Piotr Trojanek When preanalysing spec expression (e.g. expression of an expression function), the name of iterator specification within an iterated component association should not be expanded, especially in GNATprove mode. gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion of for iterated component association just like it is done within quantified expression. --- gcc/ada/sem_ch5.adb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 17bf6d91b44..6d07f3d09e5 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2429,11 +2429,12 @@ package body Sem_Ch5 is if not Is_Entity_Name (Iter_Name) - -- When the context is a quantified expression, the renaming - -- declaration is delayed until the expansion phase if we are - -- doing expansion. + -- When the context is a quantified expression or iterated component + -- association, the renaming declaration is delayed until the + -- expansion phase if we are doing expansion. - and then (Nkind (Parent (N)) /= N_Quantified_Expression + and then (Nkind (Parent (N)) not in N_Quantified_Expression + | N_Iterated_Component_Association or else (Operating_Mode = Check_Semantics and then not GNATprove_Mode))