public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix inlining of subprograms with deep param/result in GNATprove
@ 2019-10-10 15:36 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-10-10 15:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: Yannick Moy

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

In the special inlining done for GNATprove, subprograms with parameters
or result of deep type (i.e. containing an access type) should not be
inlined. This was the purpose of a previous patch. But this should not
be applied to private types whose completion has SPARK_Mode Off, as
these types are not considered as deep by GNATprove.

There is no impact on compilation, hence no test.

Tested on x86_64-pc-linux-gnu, committed on trunk

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.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 883 bytes --]

--- gcc/ada/inline.adb
+++ gcc/ada/inline.adb
@@ -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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-10 15:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-10 15:36 [Ada] Fix inlining of subprograms with deep param/result in GNATprove Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).