From patchwork Mon Sep 26 09:15:05 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: 58028 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 723323854156 for ; Mon, 26 Sep 2022 09:17:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 723323854156 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664183841; bh=rU5qQwh536vPx785tHUaJv/hrSrZ+rMenh26CJmcLB8=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=vEDkzw6p7i1I9/Ly7pl7ECiFx+dq5yqO4RBjqyobWjcotHuudoRmQclaQDqLpcKCV lgpSiouvLIgksFEuByfAK9kHIbT7v9eWxUXjK7m7eW7vY0y8P4mKv7QZcbtpZe/Zhd siJxQ2AjtvYjf0OqGuB//3pMkZbJqHXr68SJS3DU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 3E9AE385AE4D for ; Mon, 26 Sep 2022 09:15:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3E9AE385AE4D Received: by mail-wm1-x335.google.com with SMTP id iv17so4023278wmb.4 for ; Mon, 26 Sep 2022 02:15:11 -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=rU5qQwh536vPx785tHUaJv/hrSrZ+rMenh26CJmcLB8=; b=L3zTf+6uikGBQ8fRZ8XusyHVHzvXz8lj+CX9P8wYwoQWHk71IndgkM5P0/oEws2ExX ppYvnbgmbmesgMbYN7i0uU3EFbHAhzuS6tLoRM+O22PEvnSlYVkstOGntduVBqX7+5VH JxzRusP/BqWZ0zFChU64VNHgKKOeM24pQPE0bVlo4eR3jC4oqBZgUg/ABtlmY+msN8Nv 1+xYLbbIc7urvNfQcoPzAo85TFHc82jBD0xKudPDmHNIeUeQW9ADaz3GY2v85mYmaOfV sd0cEBh5YQ8WvCLhZGkA/ONEUVNCwZ8985aAdMKllVx/2RYPjX+Z2zUbK2Td5K61idJh dO3Q== X-Gm-Message-State: ACrzQf2aTlzubaW+rkTMHY6BuxPO0SuhF98L8MKZvt5CtBPntQeiHauL QO4C08LjykSuILV/tscqiHMCj37yjfVtFQ== X-Google-Smtp-Source: AMsMyM5/fP4QPbixeivuEx4x56pvpxewrZ9eaZGk4crfLsLcmmgYD+heNHLKm6v+TkeDOvfIQNEi7A== X-Received: by 2002:a7b:ca54:0:b0:3b4:fb06:9b1 with SMTP id m20-20020a7bca54000000b003b4fb0609b1mr14206583wml.67.1664183710145; Mon, 26 Sep 2022 02:15:10 -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 u7-20020a05600c4d0700b003b4e009deb2sm11708288wmp.41.2022.09.26.02.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:15:09 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [COMMITED] ada: Delay expansion of iterator specification in preanalysis Date: Mon, 26 Sep 2022 11:15:05 +0200 Message-Id: <20220926091505.273202-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+patchwork=sourceware.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 should not be expanded. This patch simplifies a complicated condition for delaying expansion within quantified expressions and iterated component associations. gcc/ada/ * sem_ch5.adb (Analyze_Iterator_Specification): Delay expansion based on Full_Analysis flag. --- gcc/ada/sem_ch5.adb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index 6d07f3d09e5..d0f00b31161 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -2429,14 +2429,9 @@ package body Sem_Ch5 is if not Is_Entity_Name (Iter_Name) - -- 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)) not in N_Quantified_Expression - | N_Iterated_Component_Association - or else (Operating_Mode = Check_Semantics - and then not GNATprove_Mode)) + -- Do not perform this expansion in preanalysis + + and then Full_Analysis -- Do not perform this expansion when expansion is disabled, where the -- temporary may hide the transformation of a selected component into