https://gcc.gnu.org/g:9113cc2e0a43a7b0c599d26e56f7fef5c4dc37d9

commit r17-862-g9113cc2e0a43a7b0c599d26e56f7fef5c4dc37d9
Author: Marc Poulhiès <[email protected]>
Date:   Thu Feb 19 11:18:23 2026 +0100

    ada: Fix freezing of nested discriminated type
    
    Simply creating the freeze node for the base type of a discriminated type
    without adjusting the scope and the visible declarations leads to an
    incorrect tree that crashes the compiler when unnesting the predicate
    function.
    
    gcc/ada/ChangeLog:
    
            * sem_ch3.adb (Find_Type_Of_Object): Adjust freezing of the base
            type of a discriminated type.
    
    Co-authored-by: Eric Botcazou <[email protected]>

Diff:
---
 gcc/ada/sem_ch3.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index ce75692cbbe8..db71829d7f44 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -19228,7 +19228,7 @@ package body Sem_Ch3 is
          --  of discriminated private type without a full view.
 
          else
-            Insert_Actions (Obj_Def, Freeze_Entity (Base_Type (T), P));
+            Freeze_Before (Obj_Def, Base_Type (T));
          end if;
 
       --  Ada 2005 AI-406: the object definition in an object declaration

Reply via email to