From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 39FAB3858002 for ; Tue, 13 Jun 2023 07:38:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 39FAB3858002 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-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3f8d1eb535eso1098275e9.3 for ; Tue, 13 Jun 2023 00:38:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1686641926; x=1689233926; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+2CxezGDKd4tmibkI1Qomql0NEutd2Zq+wMAzungwAU=; b=G2hwgJ3qE5/KH+Dt61kaW1MIi2KVO7w84Z9Zdh4i2o5pPv0XjgAwZcGPgheWkjrUHP Mgcz5jQTfD/xf2oYIbSFH6rta0dY5Tc2nBl76DZpwDwEvOvq/+TmpwoTsvI+5I2gE/hI essWcJH/qBdhwyQBCoILusCy3YJqQStYFeftaHsgou2bXfy0pRqHrHjlFTK01wmKbSj0 CnlBSMUGdK1vFwDQJ1RnzsapDakbQJ2qdkJcztfDpgmP2v3sp567mhgm6XQ3AwFxYNHS P4/E9El25engNIL+NKSwueDFjljMptIwqgCxbMmAlDYnuJg4IOGDo7g+GEhqr2trctMY mhAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686641926; x=1689233926; 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=+2CxezGDKd4tmibkI1Qomql0NEutd2Zq+wMAzungwAU=; b=frN0NmbebyPRXuCev9/KebJNHnDM6ls9/xleLAH0+zR56ETADK3yuQpPj9XLewqfFk 5oBCm8hUz+vv6KLYe+F/dX2EtrVINpKeJmnUIzw2JholhweuNrYMJugFbVKjVy3a/7Fj F5DTWIfvCdDEB5HzGVbE19rPb7BWmWACKTZE2745jhmlnIa5RE8lQXMTnG8qXQzUrXwx 5gpHzt5wUWuhCmhN6YiaDKyjOuaEZCG61yM0kQCmwmjG/JsU6w2Cjo8L3sE5XrdYpupl 5XBbLvgefAHuBq/yHUpwjmhXP4L07JXR5NjHY82r4IMqSsPWKk/Gzm98nPq8IgGvWk/X RcOw== X-Gm-Message-State: AC+VfDyUCWmXZgra2YJPMGtz7bJfS8SFFit28k6ZRYE0UUvX886TmHYf k6lI6g0Q28sMHVprndwQDtXOcOfsKfcs1IO4JK+IIw== X-Google-Smtp-Source: ACHHUZ7j6ZPD4q2VhULnGLwqBR/tjQ0AL4t/7ZyfvTWRanOiMGafl4iHbZLJ/iMeHoxHjPafATCdNw== X-Received: by 2002:a05:6000:148:b0:30f:b6f9:de28 with SMTP id r8-20020a056000014800b0030fb6f9de28mr4640496wrx.21.1686641925831; Tue, 13 Jun 2023 00:38:45 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:bfa8:5d29:40e5:cc66]) by smtp.gmail.com with ESMTPSA id t1-20020adfe101000000b0030e5a63e2dbsm14575757wrz.80.2023.06.13.00.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 00:38:45 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Fix decoration of iterated component association for GNATprove Date: Tue, 13 Jun 2023 09:38:44 +0200 Message-Id: <20230613073844.240700-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 This patch is an alternative solution for a recent fix in analysis of iterated component association. To recap, if the iterated expression is an aggregate, we want to propagate the component type downward with a call to Resolve_Aggr_Expr; otherwise we want this expression to be only preanalysed (since the association might need to be repeatedly evaluated), but also we need to apply predicate and range checks to the expression itself (these are required for GNATprove). It turns out that Resolve_Aggr_Expr already knows how to deal with a nested aggregate and also works for GNATprove, where it both preanalyzes the expression and applies necessary checks. In other words, expression of the iterated component association is now resolved just like expression of an ordinary array aggregate. gcc/ada/ * sem_aggr.adb (Resolve_Iterated_Component_Association): Simply resolve the expression. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aggr.adb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 843606ab4a1..c6063c78bf6 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -1862,14 +1862,7 @@ package body Sem_Aggr is Expr := Expression (N); - if Nkind (Expr) = N_Aggregate then - -- If the expression is an aggregate, this is a multidimensional - -- aggregate where the component type must be propagated downward. - - Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False); - else - Preanalyze_And_Resolve (Expr, Component_Typ); - end if; + Dummy := Resolve_Aggr_Expr (Expr, Single_Elmt => False); if Operating_Mode /= Check_Semantics then Remove_References (Expr); -- 2.40.0