summaryrefslogtreecommitdiffstats
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 16bfbeb539a..5cc06e7d899 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -11799,6 +11799,11 @@ package body Sem_Ch3 is
-- needed, since checks may cause duplication of the expressions
-- which must not be reevaluated.
+ -- The forced evaluation removes side effects from expressions,
+ -- which should occur also in Alfa mode. Otherwise, we end up with
+ -- unexpected insertions of actions at places where this is not
+ -- supposed to occur, e.g. on default parameters of a call.
+
if Expander_Active then
Force_Evaluation (Low_Bound (R));
Force_Evaluation (High_Bound (R));
@@ -18339,6 +18344,11 @@ package body Sem_Ch3 is
-- if needed, before applying checks, since checks may cause
-- duplication of the expression without forcing evaluation.
+ -- The forced evaluation removes side effects from expressions,
+ -- which should occur also in Alfa mode. Otherwise, we end up with
+ -- unexpected insertions of actions at places where this is not
+ -- supposed to occur, e.g. on default parameters of a call.
+
if Expander_Active then
Force_Evaluation (Lo);
Force_Evaluation (Hi);
@@ -18449,6 +18459,11 @@ package body Sem_Ch3 is
-- Case of other than an explicit N_Range node
+ -- The forced evaluation removes side effects from expressions, which
+ -- should occur also in Alfa mode. Otherwise, we end up with unexpected
+ -- insertions of actions at places where this is not supposed to occur,
+ -- e.g. on default parameters of a call.
+
elsif Expander_Active then
Get_Index_Bounds (R, Lo, Hi);
Force_Evaluation (Lo);
OpenPOWER on IntegriCloud