https://gcc.gnu.org/g:eb5cc8510d59bb57ce86841699d85fc44bbf0419

commit r16-1371-geb5cc8510d59bb57ce86841699d85fc44bbf0419
Author: Eric Botcazou <ebotca...@adacore.com>
Date:   Thu Mar 20 23:29:33 2025 +0100

    ada: Fix infinite loop with aggregate in generic unit
    
    Root_Type does not return the same type for the private and the full view of
    a derived private tagged type when both derive from an interface type.
    
    gcc/ada/ChangeLog:
    
            * sem_ch12.adb (Copy_Generic_Node): Do not call Root_Type to find
            the root type of an aggregate of a derived tagged type.

Diff:
---
 gcc/ada/sem_ch12.adb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index c9b9e7f87eca..017bcba42ef6 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -9341,9 +9341,6 @@ package body Sem_Ch12 is
               and then Nkind (Ancestor_Type (N)) in N_Entity
             then
                declare
-                  Root_Typ : constant Entity_Id :=
-                               Root_Type (Ancestor_Type (N));
-
                   Typ : Entity_Id := Ancestor_Type (N);
 
                begin
@@ -9352,7 +9349,7 @@ package body Sem_Ch12 is
                         Switch_View (Typ);
                      end if;
 
-                     exit when Typ = Root_Typ;
+                     exit when Etype (Typ) = Typ;
 
                      Typ := Etype (Typ);
                   end loop;

Reply via email to