https://gcc.gnu.org/g:42225526666aeb313fa40303d122c9cf2fb75299
commit r16-1949-g42225526666aeb313fa40303d122c9cf2fb75299 Author: Piotr Trojanek <troja...@adacore.com> Date: Thu Jun 12 00:47:38 2025 +0200 ada: Improve retrieval of nominal unconstrained type in extended return To reliably retrieve the nominal unconstrained type of object declared in extended return statement we need to rely on the Original_Node. gcc/ada/ChangeLog: * sem_ch3.adb (Check_Return_Subtype_Indication): Use Original_Node. Diff: --- gcc/ada/sem_ch3.adb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index f25941d72a83..5354d82bd7da 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4204,11 +4204,7 @@ package body Sem_Ch3 is -- to recover the nominal unconstrained type. if Is_Constr_Subt_For_U_Nominal (Obj_Typ) then - if Nkind (Object_Definition (Obj_Decl)) = N_Subtype_Indication then - Obj_Typ := Entity (Subtype_Mark (Object_Definition (Obj_Decl))); - else - Obj_Typ := Etype (Obj_Typ); - end if; + Obj_Typ := Entity (Original_Node (Object_Definition (Obj_Decl))); pragma Assert (not Is_Constrained (Obj_Typ)); end if;