]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix crash on type extensions with discriminants
authorBob Duff <duff@adacore.com>
Tue, 15 Jun 2021 19:36:34 +0000 (15:36 -0400)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 9 Jul 2021 12:35:32 +0000 (12:35 +0000)
gcc/ada/

* exp_put_image.adb (Make_Component_Attributes): Use
Implementation_Base_Type to get the parent type. Otherwise,
Parent_Type_Decl is actually an internally generated subtype
declaration, so we blow up on
Type_Definition (Parent_Type_Decl).

gcc/ada/exp_put_image.adb

index 082e08b6dde7b3ddcae90547000e76a146761c8b..87f4b74e35ace9761d80ae985a428c47cd45d4a1 100644 (file)
@@ -658,8 +658,8 @@ package body Exp_Put_Image is
                   if Chars (Defining_Identifier (Item)) = Name_uParent then
                      declare
                         Parent_Type : constant Entity_Id :=
-                          Underlying_Type (Base_Type (
-                            (Etype (Defining_Identifier (Item)))));
+                          Implementation_Base_Type
+                            (Etype (Defining_Identifier (Item)));
 
                         Parent_Aspect_Spec : constant Node_Id :=
                           Find_Aspect (Parent_Type, Aspect_Put_Image);