Commit 8f4a8bef by Arnaud Charlet

[multiple changes]

2014-08-04  Thomas Quinot  <quinot@adacore.com>

	* s-fatgen.adb: Minor reformatting.

2014-08-04  Arnaud Charlet  <charlet@adacore.com>

	* exp_util.adb (Is_Possibly_Unaligned_Object): Always return
	False on .NET.

2014-08-04  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Loop_Statement): Set properly the kind of
	the loop parameter for element iterators over containers and
	arrays, so that improper uses of it are detected in the loop
	body when expansion is disabled.
	* exp_ch5.adb (Expand_Iterator_Loop): The entity kind of the
	generated cursor is that of the analyzed loop parameter.

From-SVN: r213558
parent e7a45277
2014-08-04 Thomas Quinot <quinot@adacore.com>
* s-fatgen.adb: Minor reformatting.
2014-08-04 Arnaud Charlet <charlet@adacore.com>
* exp_util.adb (Is_Possibly_Unaligned_Object): Always return
False on .NET.
2014-08-04 Ed Schonberg <schonberg@adacore.com>
* sem_ch5.adb (Analyze_Loop_Statement): Set properly the kind of
the loop parameter for element iterators over containers and
arrays, so that improper uses of it are detected in the loop
body when expansion is disabled.
* exp_ch5.adb (Expand_Iterator_Loop): The entity kind of the
generated cursor is that of the analyzed loop parameter.
2014-08-04 Hristian Kirtchev <kirtchev@adacore.com> 2014-08-04 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch3.adb (Build_CPP_Init_Procedure): Remove * exp_ch3.adb (Build_CPP_Init_Procedure): Remove
......
...@@ -3200,6 +3200,7 @@ package body Exp_Ch5 is ...@@ -3200,6 +3200,7 @@ package body Exp_Ch5 is
Container : constant Node_Id := Name (I_Spec); Container : constant Node_Id := Name (I_Spec);
Container_Typ : constant Entity_Id := Base_Type (Etype (Container)); Container_Typ : constant Entity_Id := Base_Type (Etype (Container));
I_Kind : constant Entity_Kind := Ekind (Id);
Cursor : Entity_Id; Cursor : Entity_Id;
Iterator : Entity_Id; Iterator : Entity_Id;
New_Loop : Node_Id; New_Loop : Node_Id;
...@@ -3481,7 +3482,7 @@ package body Exp_Ch5 is ...@@ -3481,7 +3482,7 @@ package body Exp_Ch5 is
else else
Cursor := Id; Cursor := Id;
Set_Ekind (Cursor, E_Variable); -- Set_Ekind (Cursor, E_Variable);
end if; end if;
Iterator := Make_Temporary (Loc, 'I'); Iterator := Make_Temporary (Loc, 'I');
...@@ -3527,6 +3528,7 @@ package body Exp_Ch5 is ...@@ -3527,6 +3528,7 @@ package body Exp_Ch5 is
Make_Assignment_Statement (Loc, Make_Assignment_Statement (Loc,
Name => New_Occurrence_Of (Cursor, Loc), Name => New_Occurrence_Of (Cursor, Loc),
Expression => Rhs)); Expression => Rhs));
Set_Assignment_OK (Name (Last (Stats)));
end; end;
-- Generate: -- Generate:
...@@ -3592,12 +3594,15 @@ package body Exp_Ch5 is ...@@ -3592,12 +3594,15 @@ package body Exp_Ch5 is
-- The cursor is only modified in expanded code, so it appears -- The cursor is only modified in expanded code, so it appears
-- as unassigned to the warning machinery. We must suppress -- as unassigned to the warning machinery. We must suppress
-- this spurious warning explicitly. -- this spurious warning explicitly. The cursor's kind is that of
-- the original loop parameter (it is a constant if the doamin of
-- iteration is constant).
Set_Warnings_Off (Cursor); Set_Warnings_Off (Cursor);
Set_Assignment_OK (Decl); Set_Assignment_OK (Decl);
Insert_Action (N, Decl); Insert_Action (N, Decl);
Set_Ekind (Cursor, I_Kind);
end; end;
-- If the range of iteration is given by a function call that -- If the range of iteration is given by a function call that
......
...@@ -5146,6 +5146,12 @@ package body Exp_Util is ...@@ -5146,6 +5146,12 @@ package body Exp_Util is
T : constant Entity_Id := Etype (N); T : constant Entity_Id := Etype (N);
begin begin
-- Objects are never unaligned on VMs
if VM_Target /= No_VM then
return False;
end if;
-- If renamed object, apply test to underlying object -- If renamed object, apply test to underlying object
if Is_Entity_Name (N) if Is_Entity_Name (N)
......
...@@ -892,7 +892,7 @@ package body System.Fat_Gen is ...@@ -892,7 +892,7 @@ package body System.Fat_Gen is
for R'Address use XA; for R'Address use XA;
-- R is a view of the input floating-point parameter. Note that we -- R is a view of the input floating-point parameter. Note that we
-- must avoid copying the actual bits of this parameter in float -- must avoid copying the actual bits of this parameter in float
-- form (since it may be a signalling NaN. -- form (since it may be a signalling NaN).
E : constant IEEE_Exponent_Range := E : constant IEEE_Exponent_Range :=
Integer ((R (Most_Significant_Word) and Exponent_Mask) / Integer ((R (Most_Significant_Word) and Exponent_Mask) /
......
...@@ -3114,25 +3114,39 @@ package body Sem_Ch5 is ...@@ -3114,25 +3114,39 @@ package body Sem_Ch5 is
-- If the expander is not active, or in SPARK mode, then we want to -- If the expander is not active, or in SPARK mode, then we want to
-- analyze the loop body now even in the Ada 2012 iterator case, since -- analyze the loop body now even in the Ada 2012 iterator case, since
-- the rewriting will not be done. Insert the loop variable in the -- the rewriting will not be done. Insert the loop variable in the
-- current scope, if not done when analysing the iteration scheme. -- current scope, if not done when analysing the iteration scheme. Set
-- is kind properly to detect improper uses in the loop body.
if No (Iter)
or else No (Iterator_Specification (Iter))
or else not Expander_Active
then
if Present (Iter) if Present (Iter)
and then Present (Iterator_Specification (Iter)) and then Present (Iterator_Specification (Iter))
then then
if not Expander_Active then
declare declare
Id : constant Entity_Id := I_Spec : constant Node_Id := Iterator_Specification (Iter);
Defining_Identifier (Iterator_Specification (Iter)); Id : constant Entity_Id := Defining_Identifier (I_Spec);
begin begin
if Scope (Id) /= Current_Scope then if Scope (Id) /= Current_Scope then
Enter_Name (Id); Enter_Name (Id);
end if; end if;
-- In an element iterator, The loop parameter is a variable if
-- the domain of iteration (container or array) is a variable.
if not Of_Present (I_Spec)
or else not Is_Variable (Name (I_Spec))
then
Set_Ekind (Id, E_Loop_Parameter);
end if;
end; end;
Analyze_Statements (Statements (N));
end if; end if;
else
-- Pre-Ada2012 for-loops and while loops.
Analyze_Statements (Statements (N)); Analyze_Statements (Statements (N));
end if; end if;
......
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