]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
freeze.adb (Freeze_Entity, [...]): Add a guard to make sure that the Etype of a compo...
authorRobert Dewar <dewar@adacore.com>
Tue, 29 Jul 2014 13:11:55 +0000 (13:11 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 29 Jul 2014 13:11:55 +0000 (15:11 +0200)
2014-07-29  Robert Dewar  <dewar@adacore.com>

* freeze.adb (Freeze_Entity, Concurrent_Type case): Add a guard
to make sure that the Etype of a component of the corresponding
record type is present before trying to freeze it.
* sem_ch5.adb: Minor reformatting.

From-SVN: r213165

gcc/ada/ChangeLog
gcc/ada/freeze.adb
gcc/ada/sem_ch5.adb

index 2ccfdf417ca4eade07da2a0c7871130edca7a423..917f4beb415c1d45b2fbec0d2ad712f5fc57f236 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-29  Robert Dewar  <dewar@adacore.com>
+
+       * freeze.adb (Freeze_Entity, Concurrent_Type case): Add a guard
+       to make sure that the Etype of a component of the corresponding
+       record type is present before trying to freeze it.
+       * sem_ch5.adb: Minor reformatting.
+
 2014-07-29  Robert Dewar  <dewar@adacore.com>
 
        * exp_attr.adb, types.ads, types.h, exp_ch11.adb, a-except.adb,
index ddd162f9c5fa19fed6b835c72397fec5085d69b5..9aee0a128a9bcee8f52341fc6c06ddf3aed961c5 100644 (file)
@@ -4710,13 +4710,19 @@ package body Freeze is
                   Freeze_And_Append (Comp, N, Result);
 
                elsif (Ekind (Comp)) /= E_Function then
-                  if Is_Itype (Etype (Comp))
-                    and then Underlying_Type (Scope (Etype (Comp))) = E
-                  then
-                     Undelay_Type (Etype (Comp));
-                  end if;
 
-                  Freeze_And_Append (Etype (Comp), N, Result);
+                  --  The guard on the presence of the Etype seems to be needed
+                  --  for some CodePeer (-gnatcC) cases, but not clear why???
+
+                  if Present (Etype (Comp)) then
+                     if Is_Itype (Etype (Comp))
+                       and then Underlying_Type (Scope (Etype (Comp))) = E
+                     then
+                        Undelay_Type (Etype (Comp));
+                     end if;
+
+                     Freeze_And_Append (Etype (Comp), N, Result);
+                  end if;
                end if;
 
                Next_Entity (Comp);
index 3ac6e6b42d90f8549bfbf5ec85d6f9ca7a20cc01..c52f242d8f4cfdece3d9bd6eb26a68901540e998 100644 (file)
@@ -3184,6 +3184,7 @@ package body Sem_Ch5 is
 
                   --  We skip this step if we are not in code generation mode
                   --  or CodePeer mode.
+
                   --  This is the one case where we remove dead code in the
                   --  semantics as opposed to the expander, and we do not want
                   --  to remove code if we are not in code generation mode,