]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix crash on inlining in GNATprove
authorYannick Moy <moy@adacore.com>
Thu, 8 Jun 2023 14:52:24 +0000 (16:52 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 20 Jun 2023 11:25:28 +0000 (13:25 +0200)
After the recent change on detection of non-inlining, calls inside
the iterator part of a quantified expression were not considered
as preventing inlining anymore, leading to a crash later on inside
GNATprove. Now fixed.

gcc/ada/

* sem_res.adb (Resolve_Call): Fix change that replaced test for
quantified expressions by the test for potentially unevaluated
contexts. Both should be performed.

gcc/ada/sem_res.adb

index f4dfc041cd6730486092fb3e16c1706edf38933a..2c8efec524b37431efed84faaca357d53916d08d 100644 (file)
@@ -7300,6 +7300,15 @@ package body Sem_Res is
                   ("cannot inline & (in potentially unevaluated context)?",
                    N, Nam_UA);
 
+            --  Calls are not inlined inside the loop_parameter_specification
+            --  or iterator_specification of the quantified expression, as they
+            --  are only preanalyzed. Calls in the predicate part are handled
+            --  by the previous test on potentially unevaluated expressions.
+
+            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