public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5747] [Ada] Invalid memory access on finalization of class-wide type
@ 2021-12-02 16:30 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-12-02 16:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9e10b7002acb3ce6134a6343cba04691f8c2d8ff

commit r12-5747-g9e10b7002acb3ce6134a6343cba04691f8c2d8ff
Author: Justin Squirek <squirek@adacore.com>
Date:   Mon Nov 15 22:14:39 2021 +0000

    [Ada] Invalid memory access on finalization of class-wide type
    
    gcc/ada/
    
            * gcc-interface/decl.c (gnat_to_gnu_entity): Skip normal
            processing for Itypes that are E_Class_Wide_Subtype with
            Equivalent_Type set.

Diff:
---
 gcc/ada/gcc-interface/decl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 449463e799e..3d14b5feb32 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -335,11 +335,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
 
   /* Since a use of an itype is a definition, process it as such if it is in
      the main unit, except for E_Access_Subtype because it's actually a use
-     of its base type, see below.  */
+     of its base type, and for E_Class_Wide_Subtype with an Equivalent_Type
+     because it's actually a use of the latter type.  */
   if (!definition
       && is_type
       && Is_Itype (gnat_entity)
       && Ekind (gnat_entity) != E_Access_Subtype
+      && !(Ekind (gnat_entity) == E_Class_Wide_Subtype
+	   && Present (Equivalent_Type (gnat_entity)))
       && !present_gnu_tree (gnat_entity)
       && In_Extended_Main_Code_Unit (gnat_entity))
     {


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

only message in thread, other threads:[~2021-12-02 16:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-02 16:30 [gcc r12-5747] [Ada] Invalid memory access on finalization of class-wide type Pierre-Marie de Rodat

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).