* sem_ch5.adb (Analyze_Iteration_Scheme): Fix typo.
* gcc-interface/Make-lang.in: Update dependencies.
2011-08-02 Javier Miranda <miranda@adacore.com>
* sem_util.ads, sem_util.adb (Is_Variable): Add a new formal to
determine if the analysis is performed using N or Original_Node (N).
* exp_util.adb (Side_Effect_Free): Code cleanup since the new
functionality of routine Is_Variable avoids code duplication.
* checks.adb (Determine_Range): Handle temporaries generated by
Remove_Side_Effects.
2011-08-02 Javier Miranda <miranda@adacore.com>
* exp_ch4.adb (Expand_N_Quantified_Expression): Force reanalysis and
expansion of the condition. Required since the previous analysis was
done with expansion disabled (see Resolve_Quantified_Expression) and
hence checks were not inserted and record comparisons have not been
expanded.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177132
138bc75d-0d04-0410-961f-
82ee72b054a4
+2011-08-02 Javier Miranda <miranda@adacore.com>
+
+ * sem_ch5.adb (Analyze_Iteration_Scheme): Fix typo.
+ * gcc-interface/Make-lang.in: Update dependencies.
+
+2011-08-02 Javier Miranda <miranda@adacore.com>
+
+ * sem_util.ads, sem_util.adb (Is_Variable): Add a new formal to
+ determine if the analysis is performed using N or Original_Node (N).
+ * exp_util.adb (Side_Effect_Free): Code cleanup since the new
+ functionality of routine Is_Variable avoids code duplication.
+ * checks.adb (Determine_Range): Handle temporaries generated by
+ Remove_Side_Effects.
+
+2011-08-02 Javier Miranda <miranda@adacore.com>
+
+ * exp_ch4.adb (Expand_N_Quantified_Expression): Force reanalysis and
+ expansion of the condition. Required since the previous analysis was
+ done with expansion disabled (see Resolve_Quantified_Expression) and
+ hence checks were not inserted and record comparisons have not been
+ expanded.
+
2011-08-02 Ed Falis <falis@adacore.com>
* s-taprop-vxworks.adb, s-intman-vxworks.adb, s-intman-vxworks.ads:
-- Start of processing for Determine_Range
begin
+ -- For temporary constants internally generated to remove side effects
+ -- we must use the corresponding expression to determine the range of
+ -- the expression.
+
+ if Is_Entity_Name (N)
+ and then Nkind (Parent (Entity (N))) = N_Object_Declaration
+ and then Ekind (Entity (N)) = E_Constant
+ and then Is_Internal_Name (Chars (Entity (N)))
+ then
+ Determine_Range
+ (Expression (Parent (Entity (N))), OK, Lo, Hi, Assume_Valid);
+ return;
+ end if;
+
-- Prevent junk warnings by initializing range variables
Lo := No_Uint;
Cond := Relocate_Node (Condition (N));
+ -- Reset flag analyzed in the condition to force its analysis. Required
+ -- since the previous analysis was done with expansion disabled (see
+ -- Resolve_Quantified_Expression) and hence checks were not inserted
+ -- and record comparisons have not been expanded.
+
+ Reset_Analyzed_Flags (Cond);
+
if Is_Universal then
Cond := Make_Op_Not (Loc, Cond);
end if;
if Is_Entity_Name (N) then
- -- If the entity is a constant, it is definitely side effect free.
- -- Note that the test of Is_Variable (N) below might be expected
- -- to catch this case, but it does not, because this test goes to
- -- the original tree, and we may have already rewritten a variable
- -- node with a constant as a result of an earlier Force_Evaluation
- -- call.
-
- if Ekind_In (Entity (N), E_Constant, E_In_Parameter) then
- return True;
-
- -- Functions are not side effect free
-
- elsif Ekind (Entity (N)) = E_Function then
- return False;
-
-- Variables are considered to be a side effect if Variable_Ref
-- is set or if we have a volatile reference and Name_Req is off.
-- If Name_Req is True then we can't help returning a name which
-- effectively allows multiple references in any case.
- -- Need comment for Is_True_Constant test below ???
-
- elsif Is_Variable (N)
- or else (Ekind (Entity (N)) = E_Variable
- and then not Is_True_Constant (Entity (N)))
- then
+ if Is_Variable (N, Use_Original_Node => False) then
return not Variable_Ref
and then (not Is_Volatile_Reference (N) or else Name_Req);
ada/atree.adb ada/casing.ads ada/checks.ads ada/checks.adb \
ada/csets.ads ada/debug.ads ada/debug_a.ads ada/einfo.ads ada/einfo.adb \
ada/elists.ads ada/err_vars.ads ada/errout.ads ada/erroutc.ads \
- ada/eval_fat.ads ada/exp_ch11.ads ada/exp_ch2.ads ada/exp_ch4.ads \
- ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads ada/exp_disp.ads \
- ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads ada/expander.ads \
- ada/fname.ads ada/freeze.ads ada/get_targ.ads ada/gnat.ads \
- ada/g-hesorg.ads ada/g-htable.ads ada/hostparm.ads ada/interfac.ads \
- ada/itypes.ads ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb \
- ada/nlists.ads ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads \
- ada/output.ads ada/par_sco.ads ada/restrict.ads ada/rident.ads \
- ada/rtsfind.ads ada/scans.ads ada/sem.ads ada/sem_aggr.ads \
- ada/sem_attr.ads ada/sem_aux.ads ada/sem_case.ads ada/sem_case.adb \
- ada/sem_cat.ads ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads \
- ada/sem_ch5.ads ada/sem_ch5.adb ada/sem_ch6.ads ada/sem_ch8.ads \
- ada/sem_disp.ads ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads \
- ada/sem_eval.ads ada/sem_eval.adb ada/sem_intr.ads ada/sem_res.ads \
+ ada/eval_fat.ads ada/exp_aggr.ads ada/exp_ch11.ads ada/exp_ch2.ads \
+ ada/exp_ch4.ads ada/exp_ch6.ads ada/exp_ch7.ads ada/exp_code.ads \
+ ada/exp_disp.ads ada/exp_pakd.ads ada/exp_tss.ads ada/exp_util.ads \
+ ada/exp_util.adb ada/expander.ads ada/fname.ads ada/freeze.ads \
+ ada/get_targ.ads ada/gnat.ads ada/g-hesorg.ads ada/g-htable.ads \
+ ada/hostparm.ads ada/inline.ads ada/interfac.ads ada/itypes.ads \
+ ada/lib.ads ada/lib-xref.ads ada/namet.ads ada/namet.adb ada/nlists.ads \
+ ada/nlists.adb ada/nmake.ads ada/nmake.adb ada/opt.ads ada/output.ads \
+ ada/par_sco.ads ada/restrict.ads ada/rident.ads ada/rtsfind.ads \
+ ada/scans.ads ada/sem.ads ada/sem_aggr.ads ada/sem_attr.ads \
+ ada/sem_aux.ads ada/sem_case.ads ada/sem_case.adb ada/sem_cat.ads \
+ ada/sem_ch13.ads ada/sem_ch3.ads ada/sem_ch4.ads ada/sem_ch5.ads \
+ ada/sem_ch5.adb ada/sem_ch6.ads ada/sem_ch8.ads ada/sem_disp.ads \
+ ada/sem_dist.ads ada/sem_elab.ads ada/sem_elim.ads ada/sem_eval.ads \
+ ada/sem_eval.adb ada/sem_intr.ads ada/sem_prag.ads ada/sem_res.ads \
ada/sem_res.adb ada/sem_type.ads ada/sem_util.ads ada/sem_util.adb \
ada/sem_warn.ads ada/sem_warn.adb ada/sinfo.ads ada/sinfo.adb \
ada/sinfo-cn.ads ada/sinput.ads ada/snames.ads ada/sprint.ads \
-- proper trace of the value, useful in optimizations that get rid
-- of junk range checks.
- if not Has_Call_Using_Secondary_Stack (N) then
+ if not Has_Call_Using_Secondary_Stack (Original_Bound) then
Force_Evaluation (Original_Bound);
return Original_Bound;
end if;
-- Is_Variable --
-----------------
- function Is_Variable (N : Node_Id) return Boolean is
-
- Orig_Node : constant Node_Id := Original_Node (N);
- -- We do the test on the original node, since this is basically a test
- -- of syntactic categories, so it must not be disturbed by whatever
- -- rewriting might have occurred. For example, an aggregate, which is
- -- certainly NOT a variable, could be turned into a variable by
- -- expansion.
+ function Is_Variable
+ (N : Node_Id;
+ Use_Original_Node : Boolean := True) return Boolean
+ is
+ Orig_Node : Node_Id;
function In_Protected_Function (E : Entity_Id) return Boolean;
-- Within a protected function, the private components of the enclosing
-- Start of processing for Is_Variable
begin
+ -- Check if we perform the test on the original node since this may be a
+ -- test of syntactic categories which must not be disturbed by whatever
+ -- rewriting might have occurred. For example, an aggregate, which is
+ -- certainly NOT a variable, could be turned into a variable by
+ -- expansion.
+
+ if Use_Original_Node then
+ Orig_Node := Original_Node (N);
+ else
+ Orig_Node := N;
+ end if;
+
-- Definitely OK if Assignment_OK is set. Since this is something that
-- only gets set for expanded nodes, the test is on N, not Orig_Node.
-- object used to represent access-to-subprogram types. This is only
-- relevant to CIL, will always return false for other targets.
- function Is_Variable (N : Node_Id) return Boolean;
+ function Is_Variable
+ (N : Node_Id;
+ Use_Original_Node : Boolean := True) return Boolean;
-- Determines if the tree referenced by N represents a variable, i.e. can
-- appear on the left side of an assignment. There is one situation (formal
-- parameters) in which non-tagged type conversions are also considered
-- variables, but Is_Variable returns False for such cases, since it has
-- no knowledge of the context. Note that this is the point at which
-- Assignment_OK is checked, and True is returned for any tree thus marked.
+ -- Use_Original_Node is used to perform the test on Original_Node (N). By
+ -- default is True since this routine is commonly invoked as part of the
+ -- semantic analysis and it must not be disturbed by the rewriten nodes.
function Is_Visibly_Controlled (T : Entity_Id) return Boolean;
-- Check whether T is derived from a visibly controlled type. This is true