public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r15-398] ada: Fix internal error with Put_Image aspect on access-to-class-wide type
@ 2024-05-13  8:35 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2024-05-13  8:35 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:5270bfc6e8c85e99c966a696664dcc6878b8c590

commit r15-398-g5270bfc6e8c85e99c966a696664dcc6878b8c590
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Thu Jan 18 16:25:06 2024 +0100

    ada: Fix internal error with Put_Image aspect on access-to-class-wide type
    
    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.

Diff:
---
 gcc/ada/sem_ch13.adb | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 1f3f82772942..f3212f25dcc8 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-13  8:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13  8:35 [gcc r15-398] ada: Fix internal error with Put_Image aspect on access-to-class-wide type Marc Poulhi?s

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).