From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 61096385842A for ; Tue, 13 Jun 2023 07:38:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 61096385842A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-307d20548adso3605540f8f.0 for ; Tue, 13 Jun 2023 00:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686641919; x=1689233919; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XuKdeoRI9+HKKGQ/FUAisp9QJMz+9TCI7CV+qdgKa6A=; b=hkYduNcgX8Qq+DvG7J87o3DCW8SWKwa+J+DAjcZwFskqUle9J5wybU/p4Y4+EdrQbT Flwuu1D5R2iSkY0yr2C0DoT4M1qVc4rduU9TWIzRXj/z40/Y+Kd/kmMMBP8Z1rjwOYap vnmmcd2gUUQtfs2hYF6FscZhJGvn10kZyfUr4yXQdmA9MJKFbRGnkODElZIhAxJq0L6Y 6PtN0kUDYybkB1/Crgv06iC11BNVvTdEc2YX6vA8FDehSE60WHJhWXSRFqqUK4fmzuIf 9d/hGqbGO6V3IsQi3rbQApqe+duq6GXBKYeQCWmNdnHrv5F8t6wlIL+tf0gh+CFtSC/D xwjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686641919; x=1689233919; 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=XuKdeoRI9+HKKGQ/FUAisp9QJMz+9TCI7CV+qdgKa6A=; b=AuDIkmteDRPvqPSlJZKcsJDB5FcEuoo3Fu4PWlcmC4ZvvBg8wnuEGROB5YEuigp+3e ZwZpVIts3UHLPTzKX2Brz2WhsJdG+kOqShP2s+lFsrnXW12DWCUpx7gfPRKlH3LaAdLh ILweZyf0ZX9tJvU1KrbOXXDqXCOnPLEhpVW1P0wHnBpfi06l6dOzW5oORlT/PCKWynoW nXPMy9U0L0wtMW6xS58kXvMHsKhLIOjeLygBFYjp6LUJWkbUepwWi0OU9l4HpsChkFD+ HPDPDM+rdaB/a8RtBmj3gPcDFEKXgOBQpxGdhvL4G4B9/mjqcoXUCzvQlFPo5KnAVgu3 iQ2g== X-Gm-Message-State: AC+VfDxQBAdcUbtig2XlUxfY8YbXG+FV+M1+Td+vOcQ37k6uQnKNfzR3 ZW2/HpBBiUFmTlGgxtwdyEhW+ZKdnNKu/jo9PDTt+A== X-Google-Smtp-Source: ACHHUZ7kionKjSiVvLEvFU4J16zhD7JNRV6m2RjQbyTK4zdqHKZoW/p13sXfxL0QX3hGIXD0H6BHBw== X-Received: by 2002:adf:ed12:0:b0:30f:bcee:615e with SMTP id a18-20020adfed12000000b0030fbcee615emr4291324wro.71.1686641919283; Tue, 13 Jun 2023 00:38:39 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:bfa8:5d29:40e5:cc66]) by smtp.gmail.com with ESMTPSA id u13-20020adfeb4d000000b00301a351a8d6sm14481128wrn.84.2023.06.13.00.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 00:38:38 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Recognize iterated_component_association as potentially unevaluated Date: Tue, 13 Jun 2023 09:38:37 +0200 Message-Id: <20230613073837.240516-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.6 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 List-Id: From: Piotr Trojanek Routine Is_Potentially_Unevaluated was written for Ada 2012, but now we use it for Ada 2022 as well, so it must recognize iterated component associations (which were added by Ada 2022) as an array component association. gcc/ada/ * sem_util.adb (Is_Potentially_Unevaluated): Recognize iterated component association as potentially unevaluated. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b82978ba99e..23668f1bec5 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -19566,7 +19566,8 @@ package body Sem_Util is elsif Nkind (Par) = N_Quantified_Expression then return Expr = Condition (Par); - elsif Nkind (Par) = N_Component_Association + elsif Nkind (Par) in N_Component_Association + | N_Iterated_Component_Association and then Expr = Expression (Par) and then Nkind (Parent (Par)) in N_Aggregate | N_Delta_Aggregate | N_Extension_Aggregate @@ -19708,10 +19709,15 @@ package body Sem_Util is then return True; - -- For component associations continue climbing; it may be part of - -- an array aggregate. + -- For component associations continue climbing; it may be part of an + -- array aggregate. For iterated component association we know that + -- it belongs to an array aggreate, but only its expression is + -- potentially unevaluated, not discrete choice list or iterator + -- specification. - elsif Nkind (Par) = N_Component_Association then + elsif Nkind (Par) in N_Component_Association + | N_Iterated_Component_Association + then null; -- If the context is not an expression, or if is the result of -- 2.40.0