diff options
author | Javier Miranda <miranda@adacore.com> | 2024-06-06 11:20:14 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-21 10:34:21 +0200 |
commit | 96e037bcd160d2f63a04de09f2d47ed9aae082ad (patch) | |
tree | 3630d4eabc2eba689354dff3a04cd3471e52f569 /gcc/ada | |
parent | 498c6260ce0508a4c865071fed11e964d6f22b35 (diff) | |
download | gcc-96e037bcd160d2f63a04de09f2d47ed9aae082ad.zip gcc-96e037bcd160d2f63a04de09f2d47ed9aae082ad.tar.gz gcc-96e037bcd160d2f63a04de09f2d47ed9aae082ad.tar.bz2 |
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.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index a86f774..90376f8 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 |