In Alfa mode, checks are not generated by the frontend, hence there is no need
to force the evaluation of expressions for checks. This avoids inserting
useless actions in expressions.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-11-21  Yannick Moy  <m...@adacore.com>

        * sem_ch3.adb (Constrain_Index, Process_Range_Expr_In_Decl):
        Use Full_Expander_Active instead of Expander_Active to control
        the forced evaluation of expressions for the sake of generating
        checks.

Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb (revision 181572)
+++ sem_ch3.adb (working copy)
@@ -11786,7 +11786,7 @@
          --  needed, since checks may cause duplication of the expressions
          --  which must not be reevaluated.
 
-         if Expander_Active then
+         if Full_Expander_Active then
             Force_Evaluation (Low_Bound (R));
             Force_Evaluation (High_Bound (R));
          end if;
@@ -18326,7 +18326,7 @@
             --  if needed, before applying checks, since checks may cause
             --  duplication of the expression without forcing evaluation.
 
-            if Expander_Active then
+            if Full_Expander_Active then
                Force_Evaluation (Lo);
                Force_Evaluation (Hi);
             end if;
@@ -18436,7 +18436,7 @@
 
       --  Case of other than an explicit N_Range node
 
-      elsif Expander_Active then
+      elsif Full_Expander_Active then
          Get_Index_Bounds (R, Lo, Hi);
          Force_Evaluation (Lo);
          Force_Evaluation (Hi);

Reply via email to