Commit 85ee7b49 by Yannick Moy Committed by Pierre-Marie de Rodat

[Ada] Fix inlining in GNATprove inside quantified expressions

Calls to local subprograms in GNATprove may be inlined in some case, but
it should not be the case inside quantified expressions which are
handled as expressions inside GNATprove. Because quantified expressions
are only preanalayzed, the detection of the impossible inlining was not
performed.  Now fixed.

There is no impact on compilation.

2019-07-05  Yannick Moy  <moy@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve_Call): Cannot inline in quantified
	expressions.
	* sem_util.adb, sem_util.ads (In_Quantified_Expression): New
	function.

From-SVN: r273105
parent 8518042a
2019-07-05 Yannick Moy <moy@adacore.com>
* sem_res.adb (Resolve_Call): Cannot inline in quantified
expressions.
* sem_util.adb, sem_util.ads (In_Quantified_Expression): New
function.
2019-07-05 Bob Duff <duff@adacore.com>
* doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:
......
......@@ -6768,6 +6768,15 @@ package body Sem_Res is
Cannot_Inline
("cannot inline & (in default expression)?", N, Nam_UA);
-- Calls cannot be inlined inside quantified expressions, which
-- are left in expression form for GNATprove. Since these
-- expressions are only preanalyzed, we need to detect the failure
-- to inline outside of the case for Full_Analysis below.
elsif In_Quantified_Expression (N) then
Cannot_Inline
("cannot inline & (in quantified expression)?", N, Nam_UA);
-- Inlining should not be performed during preanalysis
elsif Full_Analysis then
......
......@@ -12305,6 +12305,25 @@ package body Sem_Util is
end if;
end In_Pre_Post_Condition;
------------------------------
-- In_Quantified_Expression --
------------------------------
function In_Quantified_Expression (N : Node_Id) return Boolean is
P : Node_Id;
begin
P := Parent (N);
loop
if No (P) then
return False;
elsif Nkind (P) = N_Quantified_Expression then
return True;
else
P := Parent (P);
end if;
end loop;
end In_Quantified_Expression;
-------------------------------------
-- In_Reverse_Storage_Order_Object --
-------------------------------------
......
......@@ -1410,6 +1410,9 @@ package Sem_Util is
-- Returns True if node N appears within a pre/postcondition pragma. Note
-- the pragma Check equivalents are NOT considered.
function In_Quantified_Expression (N : Node_Id) return Boolean;
-- Returns true if the expression N occurs within a quantified expression
function In_Reverse_Storage_Order_Object (N : Node_Id) return Boolean;
-- Returns True if N denotes a component or subcomponent in a record or
-- array that has Reverse_Storage_Order.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment