]> gcc.gnu.org Git - gcc.git/commitdiff
ada: Fix decoration of iterated component association for GNATprove
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 3 May 2023 13:26:23 +0000 (15:26 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 13 Jun 2023 07:31:46 +0000 (09:31 +0200)
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.

gcc/ada/sem_aggr.adb

index 843606ab4a1945c6d1c984e202b23ebab5b6ee90..c6063c78bf63e415018039bdd10f195d5cb8645c 100644 (file)
@@ -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);
This page took 0.074162 seconds and 5 git commands to generate.