https://gcc.gnu.org/g:d4c990759bcdc1f2b3384397cae6d8cb76a4cdad

commit r15-1685-gd4c990759bcdc1f2b3384397cae6d8cb76a4cdad
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Tue Jun 11 19:29:22 2024 +0200

    ada: Add missing dimension information for target names
    
    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.

Diff:
---
 gcc/ada/sem_ch5.adb | 1 +
 gcc/ada/sem_dim.adb | 2 ++
 2 files changed, 3 insertions(+)

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

Reply via email to