+2019-07-04 Yannick Moy <moy@adacore.com>
+
+ * sem_prag.adb (Check_Library_Level_Entity): Update for new rule
+ on SPARK_Mode.
+
2019-07-04 Justin Squirek <squirek@adacore.com>
* sem_disp.adb (Check_Controlling_Formals): Obtain the full view
-- Start of processing for Check_Library_Level_Entity
begin
- if not Is_Library_Level_Entity (E) then
+ -- A SPARK_Mode of On shall only apply to library-level
+ -- entities, except for those in generic instances, which are
+ -- ignored (even if the entity gets SPARK_Mode pragma attached
+ -- in the AST, its effect is not taken into account unless the
+ -- context already provides SPARK_Mode of On in GNATprove).
+
+ if Get_SPARK_Mode_From_Annotation (N) = On
+ and then not Is_Library_Level_Entity (E)
+ and then Instantiation_Location (Sloc (N)) = No_Location
+ then
Error_Msg_Name_1 := Pname;
Error_Msg_N (Fix_Error (Msg_1), N);
+2019-07-04 Yannick Moy <moy@adacore.com>
+
+ * gnat.dg/spark3.adb: New testcase.
+
2019-07-04 Justin Squirek <squirek@adacore.com>
* gnat.dg/tagged2.adb, gnat.dg/tagged2.ads: New testcase.
--- /dev/null
+-- { dg-do compile }
+
+procedure SPARK3 (X : in out Integer) with SPARK_Mode is
+
+ procedure Q (X : in out Integer) with SPARK_Mode => Off is
+ begin
+ X := X + 1;
+ end Q;
+
+ procedure R (X : in out Integer);
+
+ procedure R (X : in out Integer) with SPARK_Mode => Off is
+ begin
+ Q (X);
+ end R;
+
+begin
+ R (X);
+ X := X + 1;
+end SPARK3;