diff mbox series

[COMMITTED,11/30] ada: Miscomputed bounds for inner null array aggregates

Message ID 20240801151738.400796-11-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,01/30] ada: Remove obsolete workaround | expand

Commit Message

Marc Poulhiès Aug. 1, 2024, 3:17 p.m. UTC
From: Javier Miranda <miranda@adacore.com>

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).

Tested on x86_64-pc-linux-gnu, committed on master.

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

Patch

diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index bddfbecf46d..5f7c7321f4f 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;