]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[Ada] Fix incorrect freezing with generic child unit
authorMarc Poulhiès <poulhies@adacore.com>
Mon, 28 Mar 2022 14:03:48 +0000 (16:03 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 18 May 2022 08:40:59 +0000 (08:40 +0000)
The Analyze_Associations.Check_Generic_Parent function was using an
incorrect node as the instanciation node for the actual, possibly
leading to incorrect freeze node being created (and later crashing in
gigi). Using Get_Unit_Instantiation_Node fixes the issue.

gcc/ada/

* sem_ch12.adb (Check_Generic_Parent): Use
Get_Unit_Instantiation_Node instead of Next.

gcc/ada/sem_ch12.adb

index bc083359813a6fd7fc63bfb5f11340e0d6695e54..c5f2eed96fdbd7106e3c98a5dd022fcc848feb9f 100644 (file)
@@ -1164,7 +1164,7 @@ package body Sem_Ch12 is
       function Matching_Actual
         (F   : Entity_Id;
          A_F : Entity_Id) return Node_Id;
-      --  Find actual that corresponds to a given formal parameter. If the
+      --  Find actual that corresponds to a given formal parameter. If the
       --  actuals are positional, return the next one, if any. If the actuals
       --  are named, scan the parameter associations to find the right one.
       --  A_F is the corresponding entity in the analyzed generic, which is
@@ -2063,7 +2063,7 @@ package body Sem_Ch12 is
 
                         procedure Check_Generic_Parent is
                            Inst : constant Node_Id :=
-                                    Next (Unit_Declaration_Node (Actual));
+                                    Get_Unit_Instantiation_Node (Actual);
                            Par  : Entity_Id;
 
                         begin