]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Miscomputed bounds for inner null array aggregates
authorJavier Miranda <miranda@adacore.com>
Mon, 24 Jun 2024 11:29:57 +0000 (11:29 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:35 +0000 (17:14 +0200)
gcc/ada/

* sem_aggr.adb (Collect_Aggr_Bounds): Adjust previous patch to
store the bounds of inner null aggregates in the itype; required
generate the runtime check of ARM 4.3.3(30).

gcc/ada/sem_aggr.adb

index bddfbecf46dc768783c628230e35c3255e9e7289..5f7c7321f4f658d647602da3c1c9814b9654f785 100644 (file)
@@ -569,10 +569,9 @@ package body Sem_Aggr is
                end if;
 
             --  For null aggregates, build the bounds of their inner dimensions
-            --  (if not previously done). They are required for building the
-            --  aggregate itype.
+            --  since they are required for building the aggregate itype.
 
-            elsif No (Aggr_Range (Dim + 1)) then
+            else
                declare
                   Loc        : constant Source_Ptr := Sloc (N);
                   Typ        : constant Entity_Id := Etype (N);
@@ -622,7 +621,6 @@ package body Sem_Aggr is
                      Null_Range := Make_Range (Loc, New_Copy_Tree (Lo), Hi);
                      Analyze_And_Resolve (Null_Range, Index_Typ);
 
-                     pragma Assert (No (Aggr_Range (Num_Dim)));
                      Aggr_Low (Num_Dim)   := Low_Bound (Null_Range);
                      Aggr_High (Num_Dim)  := High_Bound (Null_Range);
                      Aggr_Range (Num_Dim) := Null_Range;