https://gcc.gnu.org/g:6be06ae88b8be8543094d712f24c52a4d2d73220
commit r15-6586-g6be06ae88b8be8543094d712f24c52a4d2d73220 Author: Eric Botcazou <ebotca...@adacore.com> Date: Wed Dec 11 13:06:07 2024 +0100 ada: Fix assertion failure on 'Old in post-condition with -gnat2022 It comes from a small oversight in the updated implementation for Ada 2022. gcc/ada/ChangeLog: PR ada/117956 * sem_util.adb (Is_Known_On_Entry): Be prepared for constants coming from a renaming declaration. Diff: --- gcc/ada/sem_util.adb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 595d3d10d0f3..ffc631a7beeb 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -31188,8 +31188,17 @@ package body Sem_Util is -- removal, e.g. by validity checks. if not Comes_From_Source (Obj) then - return - Is_Known_On_Entry (Expression (Parent (Obj))); + declare + D : constant Node_Id := + Declaration_Node (Obj); + begin + if Nkind (D) = N_Object_Renaming_Declaration + then + return Is_Known_On_Entry (Name (D)); + else + return Is_Known_On_Entry (Expression (D)); + end if; + end; end if; -- return False if not "all views are constant".