diff mbox series

[COMMITTED,5/7] ada: Add missing dimension information for target names

Message ID 20240627085232.226541-5-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,1/7] ada: Implement first half of Generalized Finalization | expand

Commit Message

Marc Poulhiès June 27, 2024, 8:52 a.m. UTC
From: Eric Botcazou <ebotcazou@adacore.com>

It is computed from the Etype of N_Target_Name nodes.

gcc/ada/

	* sem_ch5.adb (Analyze_Target_Name): Call Analyze_Dimension on the
	node once the Etype is set.
	* sem_dim.adb (OK_For_Dimension): Set to True for N_Target_Name.
	(Analyze_Dimension): Call Analyze_Dimension_Has_Etype for it.

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

---
 gcc/ada/sem_ch5.adb | 1 +
 gcc/ada/sem_dim.adb | 2 ++
 2 files changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index b92ceb17b1b..644bd21ce93 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -4201,6 +4201,7 @@  package body Sem_Ch5 is
                if Current = Expression (Context) then
                   pragma Assert (Context = Current_Assignment);
                   Set_Etype (N, Etype (Name (Current_Assignment)));
+                  Analyze_Dimension (N);
                else
                   Report_Error;
                end if;
diff --git a/gcc/ada/sem_dim.adb b/gcc/ada/sem_dim.adb
index 45a0f2ab922..39c36332497 100644
--- a/gcc/ada/sem_dim.adb
+++ b/gcc/ada/sem_dim.adb
@@ -219,6 +219,7 @@  package body Sem_Dim is
       N_Real_Literal              => True,
       N_Selected_Component        => True,
       N_Slice                     => True,
+      N_Target_Name               => True,
       N_Type_Conversion           => True,
       N_Unchecked_Type_Conversion => True,
 
@@ -1179,6 +1180,7 @@  package body Sem_Dim is
             | N_Qualified_Expression
             | N_Selected_Component
             | N_Slice
+            | N_Target_Name
             | N_Unchecked_Type_Conversion
          =>
             Analyze_Dimension_Has_Etype (N);