https://gcc.gnu.org/g:96e037bcd160d2f63a04de09f2d47ed9aae082ad
commit r15-1522-g96e037bcd160d2f63a04de09f2d47ed9aae082ad Author: Javier Miranda <mira...@adacore.com> Date: Thu Jun 6 11:20:14 2024 +0000 ada: Crash when using user defined string literals When a non-overridable aspect is explicitly specified for a non-tagged derived type, the compiler blows up processing an object declaration of an object of such type. gcc/ada/ * sem_ch13.adb (Analyze_One_Aspect): Fix code locating the entity of the parent type. Diff: --- gcc/ada/sem_ch13.adb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index a86f774018a3..90376f818a30 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -4801,8 +4801,14 @@ package body Sem_Ch13 is and then Nkind (Type_Definition (N)) = N_Derived_Type_Definition and then not In_Instance_Body then + -- In order to locate the parent type we must go first to its + -- base type because the frontend introduces an implicit base + -- type even if there is no constraint attached to it, since + -- this is closer to the Ada semantics. + declare - Parent_Type : constant Entity_Id := Etype (E); + Parent_Type : constant Entity_Id := + Etype (Base_Type (E)); Inherited_Aspect : constant Node_Id := Find_Aspect (Parent_Type, A_Id); begin