https://gcc.gnu.org/g:3d1f1416180b586549d1a1427edfe1365e86a1a0

commit r16-2400-g3d1f1416180b586549d1a1427edfe1365e86a1a0
Author: Viljar Indus <in...@adacore.com>
Date:   Mon Jun 30 22:41:45 2025 +0300

    ada: Ensure Expression_Copy has a parent before analysis
    
    Some analysis requires going up the parent chain to get the
    relevant context. Ensure that is done for the Expression_Copy
    node which is not a syntactic node.
    
    gcc/ada/ChangeLog:
    
            * sem_ch13.adb (Check_Aspect_At_End_Of_Declarations):
            Ensure the Expression_Copy always has a parent before
            calling any analyze.

Diff:
---
 gcc/ada/sem_ch13.adb | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 99acbf89e4eb..704bf3e04127 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -11241,6 +11241,13 @@ package body Sem_Ch13 is
    --  Start of processing for Check_Aspect_At_End_Of_Declarations
 
    begin
+      --  Indicate that the expression comes from an aspect specification,
+      --  which is used in subsequent analysis even if expansion is off.
+
+      if Present (End_Decl_Expr) then
+         Set_Parent (End_Decl_Expr, ASN);
+      end if;
+
       --  In an instance we do not perform the consistency check between freeze
       --  point and end of declarations, because it was done already in the
       --  analysis of the generic. Furthermore, the delayed analysis of an
@@ -11332,13 +11339,6 @@ package body Sem_Ch13 is
             end if;
          end if;
 
-         --  Indicate that the expression comes from an aspect specification,
-         --  which is used in subsequent analysis even if expansion is off.
-
-         if Present (End_Decl_Expr) then
-            Set_Parent (End_Decl_Expr, ASN);
-         end if;
-
          --  In a generic context the original aspect expressions have not
          --  been preanalyzed, so do it now. There are no conformance checks
          --  to perform in this case. As before, we have to make components

Reply via email to