[gcc r15-1522] ada: Crash when using user defined string literals
Marc Poulhi?s
dkm@gcc.gnu.org
Fri Jun 21 08:38:26 GMT 2024
https://gcc.gnu.org/g:96e037bcd160d2f63a04de09f2d47ed9aae082ad
commit r15-1522-g96e037bcd160d2f63a04de09f2d47ed9aae082ad
Author: Javier Miranda <miranda@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
More information about the Gcc-cvs
mailing list