When analyzing a Ghost expression function, expansion was disabled,
which was an issue when some entities needed to be frozen (which is
often the case as expression function are often the first freezing point
of entities).
The previous change:
"Warn on unmodified parameters of expression functions"
now triggers the disabling of the expander because it marks the body of
expression function as "coming from source".
This change adjust the disabling condition by excluding body coming from
expression function.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not disable
expander if body comes from an expression function.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch6.adb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 568b7d46db6..fd12a557108 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3743,9 +3743,14 @@ package body Sem_Ch6 is
-- user entities, as internally generated entitities might still need
-- to be expanded (e.g. those generated for types).
+ -- Do not disable expansion if the body comes from an expression
+ -- function as they are often the first freezing point of entities and
+ -- expansion is needed to freeze them properly.
+
if not CodePeer_Mode
and then Present (Ghost_Config.Ignored_Ghost_Region)
and then Comes_From_Source (Body_Id)
+ and then not From_Expression_Function
then
Expander_Active := False;
end if;
--
2.53.0