From patchwork Tue Jun 27 12:08:07 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: 113392 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8146244vqr; Tue, 27 Jun 2023 05:12:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4pR2VaSIGsOucmczZayJAVE6tsYJpYfXVqfjpyxdwU/BXd5b9vQLERcbhttHU0Uvy2UG8l X-Received: by 2002:a05:6402:35c5:b0:51b:fd09:9ec1 with SMTP id z5-20020a05640235c500b0051bfd099ec1mr11053606edc.0.1687867954168; Tue, 27 Jun 2023 05:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687867954; cv=none; d=google.com; s=arc-20160816; b=Roogap+l+wJmfSiP3JtczHzttYhRu9fe6TLpTJXRWrhDoktwM4U5tpiGCdR/9zJyl/ GzZ9vITV04qvPTm5gP7UNdfAkhhNw75zU7RyCwPe+WRN9sMXkNctEvgjFPuKzormDY6L GCsB8P37OCfKzxsFDqwjBvldvkOTFLoRtiIIzi67Vc4VsIBuc5KV9kgkmwWeVOeS3s1l 9WkUcy6ywWLCUqIxzQRVx65VR5wMpxC3HfSIPDLFkTgmAhy5U68Q+rzyIRTgXeFXcoJ3 OvLzyPW/C0507arQqnxYfPDpwzWhIzASI3vb7wAQep0yboRMM4t+oiQ1hOYE/AG77ZHO vu4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=lMpSll8WFlpGKOTmzbcpZg5NxgLO/gLa+l3wBX1QhOk=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=WMx/k1+kS/ekIVhiPvwne1xqRcx+OQOecHFJT4UVI7AATiTtm0NB9sM8RFYaEKP+FI u+63K8lv6LOqDWpOA48uxr6qXoAqh1YR9SR5/RuMKjYm7SA+HnAfSZ/8ouhvEk7tYGsn i4GsDaTUNwBO9bwR4E1dniotKpwlpuS2Hhv2GCxMETQ+R95Myr7NOUWvDUYyi9uq8pLw J1ATHq/y7wyvWSsl6/JksjusyFvL2pWOrLKJEOG6gUEJYjc3M1dpMrlkPcizZn+gISE2 v3A56RBFKNtPxGcxUQzZeUkIK1QPysjo4tNxFpSjYTJUu4sHDAz18SzJAkb9aTrlbiKP tP0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Hfh1ndfv; 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=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c6-20020aa7c746000000b0051d98e44c51si2460764eds.279.2023.06.27.05.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 05:12:34 -0700 (PDT) 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=@gcc.gnu.org header.s=default header.b=Hfh1ndfv; 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=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23A063857B9B for ; Tue, 27 Jun 2023 12:10:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23A063857B9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687867800; bh=lMpSll8WFlpGKOTmzbcpZg5NxgLO/gLa+l3wBX1QhOk=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Hfh1ndfvPao62xSt/S263sD/0x8FBc+4jyUC+8RYJemWN820rUaL6ScspMVEy340C ExzXX40pwbnd872+16yHIxAENAuifklP83xC8l09+uJkpC0FYY3m2lLVfcryTtfOin nNRcmOIMCaICJSIKeSZ/nkouDg11u7mYE4gqwr5I= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id 1DB963857702 for ; Tue, 27 Jun 2023 12:08:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DB963857702 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-31297125334so3885416f8f.0 for ; Tue, 27 Jun 2023 05:08:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687867689; x=1690459689; 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=lMpSll8WFlpGKOTmzbcpZg5NxgLO/gLa+l3wBX1QhOk=; b=BmV5EXISMbQheBTBV/gaggHBO0Lbwp4RSjb3EKDedUxp9dwory1UeKFAm4U0cbHL1o W4UxvTavxFx2httZTTCGrjdZ1hZenO9yMRmi0cTTNcz/cj+HvPazPYpvVkdzS7cezZ+c JwwVJ7K4uBve4KEM2MFtWXDp+SCgI2ANks3426GfNjHbFI+osYRcHqpfM9o9HQpV8MQK Eyi7HfGmS7hxIadtkceSZ6dMtGw8/lr/AEfz4gxrlM+63tZpepOkn1nDf7O0GT0w1HLB O9IIuDEWG8fFFb9cRQvHkn5qMmJ476mz+L3OSKP0g3oYcW2qSehMeOr8mmTAxccmiYT2 4msQ== X-Gm-Message-State: AC+VfDxtP1/Dg0Bt35QQv64M6Fyl2hmz4ON7Riztxsf/BPjORdHd5sAU 1uvaj64SQidFsbEN16Cm7VUaEb3d4pWkUHDlsOu1HQ== X-Received: by 2002:a5d:4530:0:b0:313:ed10:7f52 with SMTP id j16-20020a5d4530000000b00313ed107f52mr7958274wra.18.1687867688900; Tue, 27 Jun 2023 05:08:08 -0700 (PDT) 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 e1-20020a5d5941000000b00313e59cb371sm9040290wri.12.2023.06.27.05.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 05:08:08 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix incorrect handling of iterator specifications in recent change Date: Tue, 27 Jun 2023 14:08:07 +0200 Message-Id: <20230627120807.3420205-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.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.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?= Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769857827897128693?= X-GMAIL-MSGID: =?utf-8?q?1769857827897128693?= From: Eric Botcazou Unlike for loop parameter specifications where it references an index, the defining identifier references an element in them. gcc/ada/ * sem_ch12.adb (Check_Generic_Actuals): Check the component type of constants and variables of an array type. (Copy_Generic_Node): Fix bogus handling of iterator specifications. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch12.adb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 43fcff2c9d5..61e0ec47392 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -7192,11 +7192,16 @@ package body Sem_Ch12 is Set_Is_Hidden (E, False); end if; - -- Check directly the type of the actual objects + -- Check directly the type of the actual objects, including the + -- component type for array types. if Ekind (E) in E_Constant | E_Variable then Check_Actual_Type (Etype (E)); + if Is_Array_Type (Etype (E)) then + Check_Actual_Type (Component_Type (Etype (E))); + end if; + -- As well as the type of formal parameters of actual subprograms elsif Ekind (E) in E_Function | E_Procedure @@ -8520,13 +8525,12 @@ package body Sem_Ch12 is Copy_Descendants; end; - -- Iterator and loop parameter specifications do not have an identifier - -- denoting the index type, so we must locate it through the expression - -- to check whether the views are consistent. + -- Loop parameter specifications do not have an identifier denoting the + -- index type, so we must locate it through the defining identifier to + -- check whether the views are consistent. - elsif Nkind (N) in N_Iterator_Specification - | N_Loop_Parameter_Specification - and then Instantiating + elsif Nkind (N) = N_Loop_Parameter_Specification + and then Instantiating then declare Id : constant Entity_Id :=