public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1283] ada: Fix internal error on Big_Integer conversion ghost instance
@ 2023-05-26  7:37 Marc Poulhi?s
  0 siblings, 0 replies; only message in thread
From: Marc Poulhi?s @ 2023-05-26  7:37 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6b19eb2490675cacf72b8225d953d73029bc53fb

commit r14-1283-g6b19eb2490675cacf72b8225d953d73029bc53fb
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Sat Mar 25 21:42:11 2023 +0100

    ada: Fix internal error on Big_Integer conversion ghost instance
    
    The problem is that the ghost mode of the instance is used to analyze the
    parent of the generic body, whose own ghost mode has nothing to do with it.
    
    gcc/ada/
    
            * sem_ch12.adb (Instantiate_Package_Body): Set the ghost mode to
            that of the instance only after loading the generic's parent.
            (Instantiate_Subprogram_Body): Likewise.

Diff:
---
 gcc/ada/sem_ch12.adb | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 4fefcc8fb46..a9a3e322917 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -11911,12 +11911,6 @@ package body Sem_Ch12 is
          return;
       end if;
 
-      --  The package being instantiated may be subject to pragma Ghost. Set
-      --  the mode now to ensure that any nodes generated during instantiation
-      --  are properly marked as Ghost.
-
-      Set_Ghost_Mode (Act_Decl_Id);
-
       Expander_Mode_Save_And_Set (Body_Info.Expander_Status);
 
       --  Re-establish the state of information on which checks are suppressed.
@@ -12029,6 +12023,12 @@ package body Sem_Ch12 is
          Instantiation_Node := Inst_Node;
       end if;
 
+      --  The package being instantiated may be subject to pragma Ghost. Set
+      --  the mode now to ensure that any nodes generated during instantiation
+      --  are properly marked as Ghost.
+
+      Set_Ghost_Mode (Act_Decl_Id);
+
       if Present (Gen_Body_Id) then
          Save_Env (Gen_Unit, Act_Decl_Id);
          Style_Check := False;
@@ -12468,12 +12468,6 @@ package body Sem_Ch12 is
          return;
       end if;
 
-      --  The subprogram being instantiated may be subject to pragma Ghost. Set
-      --  the mode now to ensure that any nodes generated during instantiation
-      --  are properly marked as Ghost.
-
-      Set_Ghost_Mode (Act_Decl_Id);
-
       Expander_Mode_Save_And_Set (Body_Info.Expander_Status);
 
       --  Re-establish the state of information on which checks are suppressed.
@@ -12511,6 +12505,12 @@ package body Sem_Ch12 is
 
       Instantiation_Node := Inst_Node;
 
+      --  The subprogram being instantiated may be subject to pragma Ghost. Set
+      --  the mode now to ensure that any nodes generated during instantiation
+      --  are properly marked as Ghost.
+
+      Set_Ghost_Mode (Act_Decl_Id);
+
       if Present (Gen_Body_Id) then
          Gen_Body := Unit_Declaration_Node (Gen_Body_Id);

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

only message in thread, other threads:[~2023-05-26  7:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26  7:37 [gcc r14-1283] ada: Fix internal error on Big_Integer conversion ghost instance 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).