https://gcc.gnu.org/g:0dbf7285acabc4b61e31adce4ef84320df3d929c

commit r15-2617-g0dbf7285acabc4b61e31adce4ef84320df3d929c
Author: Javier Miranda <mira...@adacore.com>
Date:   Mon Jun 24 11:29:57 2024 +0000

    ada: Miscomputed bounds for inner null array aggregates
    
    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).

Diff:
---
 gcc/ada/sem_aggr.adb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index bddfbecf46dc..5f7c7321f4f6 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -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;

Reply via email to