]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix checking of SPARK RM on ghost with concurrent part
authorYannick Moy <moy@adacore.com>
Mon, 27 May 2024 10:06:47 +0000 (12:06 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 20 Jun 2024 08:50:58 +0000 (10:50 +0200)
SPARK RM 6.9(21) forbids a ghost type to have concurrent parts.
This was not enforced, instead only the type itself was checked to
be concurrent. Now fixed.

gcc/ada/

* ghost.adb (Check_Ghost_Type): Fix checking.

gcc/ada/ghost.adb

index d220e0e1ec0d97e4dbef71e702b5480b45d3ecde..84fd40ed98af4adaf25e77fd33187453ec47b1ee 100644 (file)
@@ -1054,7 +1054,9 @@ package body Ghost is
       Full_Typ : Entity_Id;
 
    begin
-      if Is_Ghost_Entity (Typ) then
+      if Is_Ghost_Entity (Typ)
+        and then Comes_From_Source (Typ)
+      then
          Conc_Typ := Empty;
          Full_Typ := Typ;
 
@@ -1062,7 +1064,9 @@ package body Ghost is
             Conc_Typ := Anonymous_Object (Typ);
             Full_Typ := Conc_Typ;
 
-         elsif Is_Concurrent_Type (Typ) then
+         elsif Has_Protected (Typ)
+           or else Has_Task (Typ)
+         then
             Conc_Typ := Typ;
          end if;