aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/inline.adb
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2020-05-17 17:57:05 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2020-07-08 10:55:50 -0400
commit85f6d7e2d277bc7d409302673892ff2ca2c45535 (patch)
tree4eb82ce8ad1f9de973ea4f47232f4732a22deb34 /gcc/ada/inline.adb
parent0f2d27e5fe82467329e0bbe8295bb4857b5da53c (diff)
downloadgcc-85f6d7e2d277bc7d409302673892ff2ca2c45535.zip
gcc-85f6d7e2d277bc7d409302673892ff2ca2c45535.tar.gz
gcc-85f6d7e2d277bc7d409302673892ff2ca2c45535.tar.bz2
[Ada] Static expression function problems with -gnatc and -gnatd.F (SPARK mode)
gcc/ada/ * exp_ch6.adb (Expand_Simple_Function_Return): Remove ugly code that was copying the return expression, resetting Analyzed flags, etc. for the return expression of static expression functions. * inline.adb (Inline_Static_Expression_Function_Call): Set the Parent of the copied expression to that of the call. This avoids a blowup in Insert_Actions when GNATprove_Mode is set and there are nested SEF calls. Add ??? comment. * sem_ch6.adb (Analyze_Expression_Function): In the case of a static expression function, create a new copy of the expression and replace the function's expression with the copy; the original expression is used in the expression function's body and will be analyzed and rewritten, and we need to save a clean copy for later use in processing static calls to the function. This allows removing the kludgy code that was in Expand_Simple_Function_Return. * sem_eval.adb (Eval_Qualified_Expression): Return immediately if any errors have been posted on the qualified expression, to avoid blowups when GNATprove_Mode is enabled (or with -gnatd.F), since illegal static expressions are handled differently in that case and attempting to fold such expressions would fail.
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r--gcc/ada/inline.adb7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index d1a6ee3..53ca685 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -4714,6 +4714,13 @@ package body Inline is
Establish_Actual_Mapping_For_Inlined_Call (N, Subp, Decls, Func_Expr);
+ -- Ensure that the copy has the same parent as the call (this seems
+ -- to matter when GNATprove_Mode is set and there are nested static
+ -- calls; prevents blowups in Insert_Actions, though it's not clear
+ -- exactly why this is needed???).
+
+ Set_Parent (Expr_Copy, Parent (N));
+
Insert_Actions (N, Decls);
-- Now substitute actuals for their corresponding formal references