]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix internal error with Put_Image aspect on access-to-class-wide type
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 18 Jan 2024 15:25:06 +0000 (16:25 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 13 May 2024 08:03:27 +0000 (10:03 +0200)
This occurs with an instantiation of Ada.Containers.Vectors in a nested
package on an access-to-class-wide type declared with the Put_Image aspect
because of too late a freezing for the internal renaming generated for the
Put_Image procedure.

The change freezes this renaming immediately in this particular case; this
is similar to a trick used in Build_Array_Put_Image_Procedure.

gcc/ada/

* sem_ch13.adb (New_Put_Image_Subprogram): In the nondeferred case
coming from an aspect and for a type with delaying freezing, also
freeze the subprogram immediately.

gcc/ada/sem_ch13.adb

index 1f3f8277294229d8b48ec71df86ef14222e107da..f3212f25dcc8c211102526900c7aa1bd1c8fa8ec 100644 (file)
@@ -15112,6 +15112,11 @@ package body Sem_Ch13 is
       then
          Append_Freeze_Action (Ent, Subp_Decl);
 
+         --  We may freeze Subp_Id immediately since Ent has just been frozen.
+         --  This will help to shield us from potential late freezing issues.
+
+         Set_Is_Frozen (Subp_Id);
+
       else
          Insert_Action (N, Subp_Decl);
          Set_Entity (N, Subp_Id);