From: Eric Botcazou <ebotca...@adacore.com> 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. Tested on x86_64-pc-linux-gnu, committed on master. --- 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 595d3d10d0f..ffc631a7bee 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". -- 2.43.0