[Ada] Fix inlining of subprograms with deep param/result in GNATprove
authorYannick Moy <moy@adacore.com>
Thu, 10 Oct 2019 15:25:22 +0000 (15:25 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 10 Oct 2019 15:25:22 +0000 (15:25 +0000)
2019-10-10  Yannick Moy  <moy@adacore.com>

gcc/ada/

* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Do not peek
under private types whose completion is SPARK_Mode Off.

From-SVN: r276833

gcc/ada/ChangeLog
gcc/ada/inline.adb

index adc61c44011cd4e0e44ef636c89bd41b41f1ba5d..ce35fcdbd3323737bfcb6f5686337fe79cdb0ee2 100644 (file)
@@ -1,5 +1,4 @@
-2019-10-10  Gary Dismukes  <dismukes@adacore.com>
+2019-10-10  Yannick Moy  <moy@adacore.com>
 
-       * exp_ch4.adb, sem_cat.adb, sem_ch12.adb, sem_ch3.adb,
-       sem_ch6.adb, sem_prag.adb, sem_util.adb, sem_util.ads: Minor
-       typo fixes.
\ No newline at end of file
+       * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Do not peek
+       under private types whose completion is SPARK_Mode Off.
\ No newline at end of file
index be2259479d2554b6e56691334ec87a4a75fefcf0..0d80ab220ba322fd4dbec2acfe76e5ec12c2733f 100644 (file)
@@ -1582,6 +1582,20 @@ package body Inline is
 
                   if No (Underlying_Type (Typ)) then
                      return True;
+
+                  --  Do not peek under a private type if its completion has
+                  --  SPARK_Mode Off. In such a case, a deep type is considered
+                  --  by GNATprove to be not deep.
+
+                  elsif Present (Full_View (Typ))
+                    and then Present (SPARK_Pragma (Full_View (Typ)))
+                    and then Get_SPARK_Mode_From_Annotation
+                      (SPARK_Pragma (Full_View (Typ))) = Off
+                  then
+                     return False;
+
+                  --  Otherwise peek under the private type.
+
                   else
                      return Is_Deep (Underlying_Type (Typ));
                   end if;