[gcc r12-6246] [Ada] Compiler crash with -gnatR2 and with of child

Pierre-Marie de Rodat pmderodat@gcc.gnu.org
Wed Jan 5 11:35:14 GMT 2022


https://gcc.gnu.org/g:f3799ac534385c72f72d97aa142aa4f9c0d72849

commit r12-6246-gf3799ac534385c72f72d97aa142aa4f9c0d72849
Author: Bob Duff <duff@adacore.com>
Date:   Wed Dec 1 12:28:00 2021 -0500

    [Ada] Compiler crash with -gnatR2 and with of child
    
    gcc/ada/
    
            * repinfo.adb (List_Entities): The code was assuming that if we
            encounter a package in the current scope, then it must be
            a (physically) nested package.  That was wrong, because it could
            be a child package.  Avoid recursing into child packages; they
            have not been annotated with representation information, and
            -gnatR2 queries that information.

Diff:
---
 gcc/ada/repinfo.adb | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index 36ad8050d1f..8bf67d3c194 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -568,12 +568,14 @@ package body Repinfo is
                   end if;
                end if;
 
-               --  Recurse into nested package, but not if they are package
-               --  renamings (in particular renamings of the enclosing package,
-               --  as for some Java bindings and for generic instances).
+               --  Recurse into nested package, but not child packages, and not
+               --  nested package renamings (in particular renamings of the
+               --  enclosing package, as for some Java bindings and for generic
+               --  instances).
 
                if Ekind (E) = E_Package then
-                  if No (Renamed_Entity (E)) then
+                  if No (Renamed_Entity (E)) and then not Is_Child_Unit (E)
+                  then
                      List_Entities (E, Bytes_Big_Endian);
                   end if;


More information about the Gcc-cvs mailing list