]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix freezing of nested discriminated type
authorMarc Poulhiès <poulhies@adacore.com>
Thu, 19 Feb 2026 10:18:23 +0000 (11:18 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 28 May 2026 08:52:46 +0000 (10:52 +0200)
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 <botcazou@adacore.com>
gcc/ada/sem_ch3.adb

index ce75692cbbe83859e72cdeb952fbc8c5c43b14bc..db71829d7f44ef914581e446cb21597db572e12b 100644 (file)
@@ -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