]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix spurious error on generic state in SPARK
authorYannick Moy <moy@adacore.com>
Mon, 8 Jan 2024 08:53:58 +0000 (09:53 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 7 May 2024 07:55:53 +0000 (09:55 +0200)
The public state of a generic package needs not be part of the state of
the enclosing unit, only the state of instantiations need to be accounted
for in the enclosing package. Now fixed.

gcc/ada/

* sem_util.adb (Find_Placement_In_State_Space): Stop search for
placement when reaching the public state of a generic package.

gcc/ada/sem_util.adb

index 3af029fd9a31f11512a14de3d052222b898dc163..d629c76fd473763aceb02caa0cc72735d72a2214 100644 (file)
@@ -9103,6 +9103,14 @@ package body Sem_Util is
                Placement := Private_State_Space;
                return;
 
+            --  The item or its enclosing package appear in the visible state
+            --  space of a generic package.
+
+            elsif Ekind (Pack_Id) = E_Generic_Package then
+               Placement := Not_In_Package;
+               Pack_Id := Empty;
+               return;
+
             --  When the item appears in the visible state space of a package,
             --  continue to climb the scope stack as this may not be the final
             --  state space.