]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: VAST found bug: Itypes with Parent
authorBob Duff <duff@adacore.com>
Thu, 27 Mar 2025 10:14:33 +0000 (06:14 -0400)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 10 Jun 2025 07:32:08 +0000 (09:32 +0200)
Fix the comment about Itypes, so the Parent field is no longer required.

Change VAST to no longer require it. Remove Check_Itype_Parents
from Check_Enum; it can no longer fail, so there's no point in
making it switchable.

gcc/ada/ChangeLog:

* einfo.ads (Associated_Node_For_Itype): Document that
Parent field may be empty.
* vast.adb:  Allow empty Parent in Itypes.

gcc/ada/einfo.ads
gcc/ada/vast.adb

index e529a64e0f67a9c22558cc92eb90f4eddd5d3d0e..495a1932109a30ce142be8edef2bb71aad90d63f 100644 (file)
@@ -463,11 +463,13 @@ package Einfo is
 
 --       For an access_to_protected_subprogram parameter it is the declaration
 --       of the corresponding formal parameter.
---
---       Itypes have no explicit declaration, and therefore are not attached to
---       the tree: their Parent field is always empty. The Associated_Node_For_
---       Itype is the only way to determine the construct that leads to the
---       creation of a given itype entity.
+
+--       Itypes need not have an explicit declaration, in which case they are
+--       not attached to the tree through the Parent field, which is empty. In
+--       other cases, they have one and are attached to the tree through the
+--       Parent field as usual. Associated_Node_For_Itype should be used to
+--       determine the construct that leads to the creation of a given itype
+--       entity.
 
 --    Associated_Storage_Pool [root type only]
 --       Defined in simple and general access type entities. References the
index a48707b2ce5cb9aa482a79911ce3ec99286cdaad..acb48b6254db843807b236e370b37ebdbe7afd75 100644 (file)
@@ -50,12 +50,11 @@ package body VAST is
    --  False means disabled checks are silent; True means we print a message
    --  (but still don't raise VAST_Failure).
 
-   type Check_Enum is (Check_Other, Check_Itype_Parents, Check_Error_Nodes);
+   type Check_Enum is (Check_Other, Check_Error_Nodes);
    Enabled_Checks : constant array (Check_Enum) of Boolean :=
---     (Check_Other => True, others => False);
-     (others => True);
---     (Check_Itype_Parents => False, -- this one fails in bootstrap!
---      others => True);
+     (Check_Other => True,
+--      others => False);
+      others => True);
    --  Passing checks are Check_Other, which should always be enabled.
    --  Currently-failing checks are different enumerals in Check_Enum,
    --  which can be disabled individually until we fix the bugs, or enabled
@@ -152,9 +151,10 @@ package body VAST is
       if Nkind (N) = N_Compilation_Unit then
          Assert (No (Parent (N)));
          --  The root of each unit should not have a parent
+
       elsif N in N_Entity_Id and then Is_Itype (N) then
-         Assert (No (Parent (N)), Check_Itype_Parents);
-         --  Itypes should not have a parent
+         null; --  An Itype might or might not have a parent
+
       else
          if Nkind (N) = N_Error then
             Assert (False, Check_Error_Nodes);