From: Viljar Indus Date: Mon, 30 Jun 2025 19:41:45 +0000 (+0300) Subject: ada: Ensure Expression_Copy has a parent before analysis X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d1f1416180b586549d1a1427edfe1365e86a1a0;p=thirdparty%2Fgcc.git 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 --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 99acbf89e4e..704bf3e0412 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