Commit 33ca2867 by Arnaud Charlet

[multiple changes]

2014-07-31  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Iterator_Specification): If the domain of
	iteration is an array component that depends on discriminants,
	create an actual subtype for it, because the preanalysis of the
	iterator name does not create actual subtypes of components.

2014-07-31  Hristian Kirtchev  <kirtchev@adacore.com>

	* freeze.adb (Freeze_Expression): Update the loop in charge
	of finding a proper insertion place for freeze nodes to handle
	N_Expression_With_Actions nodes.

From-SVN: r213333
parent 0407af53
2014-07-31 Hristian Kirtchev <kirtchev@adacore.com>
* freeze.adb (Freeze_Expression): Update the loop in charge
of finding a proper insertion place for freeze nodes to handle
N_Expression_With_Actions nodes.
2014-07-31 Robert Dewar <dewar@adacore.com> 2014-07-31 Robert Dewar <dewar@adacore.com>
* sem_util.adb, a-ngelfu.ads, prj-nmsc.adb, prj-conf.adb: Minor * sem_util.adb, a-ngelfu.ads, prj-nmsc.adb, prj-conf.adb: Minor
......
...@@ -6143,13 +6143,26 @@ package body Freeze is ...@@ -6143,13 +6143,26 @@ package body Freeze is
exit when Is_List_Member (P); exit when Is_List_Member (P);
-- Note: The N_Loop_Statement is a special case. A type that -- Freeze nodes produced by an expression coming from the Actions
-- appears in the source can never be frozen in a loop (this -- list of a N_Expression_With_Actions node must remain within the
-- occurs only because of a loop expanded by the expander), so we -- Actions list. Inserting the freeze nodes further up the tree
-- keep on going. Otherwise we terminate the search. Same is true -- may lead to use before declaration issues in the case of array
-- of any entity which comes from source. (if they have predefined -- types.
-- type, that type does not appear to come from source, but the
-- entity should not be frozen here). when N_Expression_With_Actions =>
if Is_List_Member (P)
and then List_Containing (P) = Actions (Parent_P)
then
exit;
end if;
-- Note: N_Loop_Statement is a special case. A type that appears
-- in the source can never be frozen in a loop (this occurs only
-- because of a loop expanded by the expander), so we keep on
-- going. Otherwise we terminate the search. Same is true of any
-- entity which comes from source. (if they have predefined type,
-- that type does not appear to come from source, but the entity
-- should not be frozen here).
when N_Loop_Statement => when N_Loop_Statement =>
exit when not Comes_From_Source (Etype (N)) exit when not Comes_From_Source (Etype (N))
......
...@@ -1750,11 +1750,33 @@ package body Sem_Ch5 is ...@@ -1750,11 +1750,33 @@ package body Sem_Ch5 is
and then not ASIS_Mode and then not ASIS_Mode
then then
declare declare
Id : constant Entity_Id := Make_Temporary (Loc, 'R', Iter_Name); Id : constant Entity_Id := Make_Temporary (Loc, 'R', Iter_Name);
Decl : Node_Id; Decl : Node_Id;
Act_S : Node_Id;
begin begin
Typ := Etype (Iter_Name);
-- If the domain of iteration is an array component that depends
-- on a discriminant, create actual subtype for it. Pre-analysis
-- does not generate the actual subtype of a selected component.
if Nkind (Iter_Name) = N_Selected_Component
and then Is_Array_Type (Etype (Iter_Name))
then
Act_S :=
Build_Actual_Subtype_Of_Component
(Etype (Selector_Name (Iter_Name)), Iter_Name);
Insert_Action (N, Act_S);
if Present (Act_S) then
Typ := Defining_Identifier (Act_S);
else
Typ := Etype (Iter_Name);
end if;
else
Typ := Etype (Iter_Name);
end if;
-- Protect against malformed iterator -- Protect against malformed iterator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment